public async Task SellProgramAsync(int id, ProgramSellBindingModel model, string username) { var program = await this.GetProgramByIdAsync(id, username); program.IsForSale = true; program.Price = model.Price; await this.DbContext.SaveChangesAsync(); }
public async Task <IActionResult> Sell(int id, ProgramSellBindingModel model) { if (!this.ModelState.IsValid) { return(await this.Sell(id)); } await this.programsService.SellProgramAsync(id, model, this.User.Identity.Name); return(this.RedirectToAction(ActionConstants.Index, ControllerConstants.Programs, new { area = RolesConstants.Trainer })); }