public async Task <IActionResult> Create([Bind("SsubjectId,SsubjectName")] Ssubject ssubject) { if (ModelState.IsValid) { await _rep.AddAsyn(ssubject); return(RedirectToAction(nameof(Index))); } return(View(ssubject)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,InvoiceNumber,DateCreated,DateOfShipment,ManagerId,Annotation")] Invoice model) { if (id != model.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var ModelInvoiceId = model.Id; if (model.Id == 0) { await invoiceRep.AddAsyn(model); } else { await invoiceRep.UpdateAsyn(model, model.Id); } } catch (DbUpdateConcurrencyException) { if (!InvoiceExists(model.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Filter))); } ViewData["ManagerId"] = new SelectList(мanagerRep.GetAll(), "Id", "LastName", model.ManagerId); return(View(model)); }