public async Task <IActionResult> Create([Bind("Id,ChannelType,Sequence,Color")] FncChannelType fncChannelType) { if (ModelState.IsValid) { _context.Add(fncChannelType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(PartialView("~/Areas/Finance/Views/FncChannelType/CreateEdit.cshtml", fncChannelType)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ChannelType,Sequence,Color")] FncChannelType fncChannelType) { if (id != fncChannelType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fncChannelType); await _context.SaveChangesAsync(); var front = _context.BrhFrontDeskAccounts.ToList(); foreach (var f in front) { if (fncChannelType.ChannelType == f.Channel) { f.Color = fncChannelType.Color; } _context.Update(f); } await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FncChannelTypeExists(fncChannelType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(PartialView("~/Areas/Finance/Views/FncChannelType/CreateEdit.cshtml", fncChannelType)); }