public async Task <IActionResult> PutTrack(int id, Track track) { if (id != track.Id) { return(BadRequest()); } _context.Entry(track).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TrackExists(id)) { return(NotFound()); } else { throw; } } // return NoContent(); return(CreatedAtAction("GetTrack", new { id = track.Id }, track)); }
public ActionResult Edit(int id, WorkOrden orden) { try { // TODO: Add update logic here if (ModelState.IsValid) { if (ValidBatch(orden.BatchOrden) == false) { ViewBag.Catalog = new SelectList(context.Catalog, "CatalogId", "CatalogDescrip"); context.Entry(orden).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index")); } else { ViewBag.Catalog = new SelectList(context.Catalog, "CatalogId", "CatalogDescrip"); this.ModelState.AddModelError(string.Empty, "El número de la orden ya se encuentra registrado"); return(View()); } } else { ViewBag.Catalog = new SelectList(context.Catalog, "CatalogId", "CatalogDescrip"); return(View()); } } catch { return(View()); } }
public ActionResult Edit(int id, Catalog catalog, HttpPostedFileBase image) { try { // TODO: Add update logic here if (ModelState.IsValid) { ViewBag.Family = new SelectList(context.FamilyProduct, "FamilyProductId", "nameFamily"); string img = ""; if (image != null) { //catalog.image = new byte[image.ContentLength]; //image.InputStream.Read(catalog.image, 0, image.ContentLength); img = System.IO.Path.GetFileName(image.FileName); string physicalPath = Server.MapPath("~/fonts/images/" + img); image.SaveAs(physicalPath); catalog.image = img; } context.Entry(catalog).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index")); } else { ViewBag.Family = new SelectList(context.FamilyProduct, "FamilyProductId", "nameFamily"); return(View()); } } catch { return(View()); } }
public ActionResult Edit(Officer officer) { if (ModelState.IsValid) { db.Entry(officer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(officer)); }
public virtual int Update <T>(T TObject) where T : class { try { var entry = Context.Entry(TObject); Context.Set <T>().Attach(TObject); entry.State = EntityState.Modified; return(Context.SaveChanges()); } catch (OptimisticConcurrencyException ex) { throw ex; } }
public ActionResult Edit(Resource resource) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Resources")); } if (ModelState.IsValid) { db.Entry(resource).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(resource)); }
public ActionResult Edit(Meet meet) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Schedule")); } if (ModelState.IsValid) { db.Entry(meet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(meet)); }
public ActionResult Edit(BoosterEvent boosterevent) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Boosters")); } if (ModelState.IsValid) { db.Entry(boosterevent).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(boosterevent)); }
public ActionResult Edit(Coach coach) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Staff")); } if (ModelState.IsValid) { db.Entry(coach).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(coach)); }
public ActionResult Edit(Article article) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("News")); } if (ModelState.IsValid) { article.PostedDate = DateTime.UtcNow.AddHours(-7); db.Entry(article).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(article)); }
public ActionResult Edit(int id, Employee_type emp) { try { // TODO: Add update logic here if (ModelState.IsValid) { context.Entry(emp).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index", "Config")); } else { return(View()); } } catch { return(View()); } }
public ActionResult Edit(int id, FamilyProduct model) { try { // TODO: Add update logic here if (ModelState.IsValid) { context.Entry(model).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index")); } else { return(View()); } } catch { return(View()); } }
public ActionResult Edit(int id, Users user) { try { // TODO: Add update logic here if (ModelState.IsValid) { user.active = true; context.Entry(user).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } } catch { return(View()); } }
public ActionResult Create(DeliveryOrder model) { try { // TODO: Add insert logic here if (ModelState.IsValid) { context.Entry(model).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); int area = (int)Session["temparea"]; int id = (int)Session["tempid"]; return(RedirectToAction("FinishOrden", "Area_Orden", new { id = id, areaid = area })); } else { return(RedirectToAction("Index", "Home")); } } catch (Exception ex) { var x = ex.Message; return(View()); } }
public ActionResult Edit(int id, DelayWork delay) { try { ViewBag.DelayCode = new SelectList(context.DelayCode, "DelayCodeId", "DelayName"); ViewBag.WorkOrden = new SelectList(context.WorkOrden, "WorkOrdenId", "BatchOrden"); ViewBag.Users = new SelectList(context.Users, "UsersId", "username"); // TODO: Add update logic here if (ModelState.IsValid) { context.Entry(delay).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(RedirectToAction("Index")); } else { return(View()); } } catch { return(View()); } }