Answer the question
In order to leave comments, you need to log in
ASP.NET Core request?
There is a request for the following plan:
[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);
}
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question