public async Task <IHttpActionResult> PutContractor(Guid id, Contractor contractor) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != contractor.Id) { return(BadRequest()); } db.Entry(contractor).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContractorExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Date,ContractorId,NativeId,NodeId")] Link link) { if (ModelState.IsValid) { link.Id = Guid.NewGuid(); link.Date = DateTime.Now; db.Entry(link.Contractor).State = EntityState.Unchanged; db.Entry(link.Node).State = EntityState.Unchanged; db.LinkSet.Add(link); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.ContractorId = new SelectList(db.ContractorSet, "Id", "Name", link.ContractorId); ViewBag.NodeId = new SelectList(db.NodeSet, "Id", "Name", link.NodeId); return(View(link)); }
public ActionResult Edit([Bind(Include = "Id, Name, FullName, LegalAddress, INN, OKPO")] Contractor contractor) { if (ModelState.IsValid) { db.Entry(contractor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(contractor)); }
public ActionResult Edit([Bind(Include = "Id,Number")] Contract contract) { if (ModelState.IsValid) { db.Entry(contract).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(contract)); }
public ActionResult Edit([Bind(Include = "Id,Name,IsActive,Alias")] Node node) { if (ModelState.IsValid) { db.Entry(node).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(node)); }