S
S
sdfdgfhgfh2018-09-24 22:33:55
ASP.NET
sdfdgfhgfh, 2018-09-24 22:33:55

ASP.NET Core request?

There is a request for the following plan:

Open
[HttpPost]
    public async Task<IActionResult> Ref(RefModel model)
    {
        var countreward = from c in db.Person
                            join g in db.Referal
                            on c.AccountID equals g.memb___id into gg
                            from ggg in gg.DefaultIfEmpty()
 
                            where ggg.referal_reward >= 1
                            where c.RCount >= 1
 
 
                            orderby c.AccountID == User.Identity.Name
 
                            select new Person()
                            {
                                AccountID = c.AccountID,
                                Name = c.Name,
                            };
        var reward = countreward.ToList();
 
        if (ModelState.IsValid)
        {
            if (reward.Count >= 1)
            {
                CSData bonus = db.CSData.First(p => p.AccountID == User.Identity.Name);
                bonus.GP+= 10 * reward.Count;
 
                db.CSData.Update(bonus);
                await db.SaveChangesAsync();
 
                ViewBag.Message = "Да";
            }
            else
            {
                ViewBag.Message = "Нет";
            }
        }
        return View(model);
    }


After clicking on the button, I get all the referrals I need from the Referal table, compare their login according to the required criterion with the Person table, and after that I get +=10 to my login. And now the question is: how do I send +=5 to those for whom I received +=10? I mean, I don’t understand a little how, what and with what to compare.
To put it simply:
How do I send 5 points to those who gave me 10 points?
Thanks for any advice, or example!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kuznetsov, 2018-09-25
@DarkRaven

Too little data. Where are the model diagrams?
In theory, how can you log your receipts, keeping how much and from whom.
Well, then just calculate at the right time: how much and from whom (grouping from whom and the amount by value, for example), and, if your condition is met, then put down those from whom yours came from +5.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question