public ActionResult DeleteConfirmed(int id) { PoRceived poRceived = db.PoRceiveds.Find(id); db.PoRceiveds.Remove(poRceived); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: PoRceiveds/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PoRceived poRceived = db.PoRceiveds.Find(id); if (poRceived == null) { return(HttpNotFound()); } return(View(poRceived)); }
public ActionResult Edit([Bind(Include = "PoRceivedId,CompanyNameEn,CompanyNameAr,PoCode,CreatedBy,CreatedDate,LastUpdateBy,LastUpdateDate,Active")] PoRceived poRceived) { if (ModelState.IsValid) { var user = db.Users.Where(u => "kk" + u.JobNumber == User.Identity.Name).FirstOrDefault(); poRceived.LastUpdateBy = user.FirstNameEn + " " + user.LastNameEn; poRceived.LastUpdateDate = DateTime.Now; db.Entry(poRceived).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(poRceived)); }