public async Task <IActionResult> PutDepartment(int id, Department department) { if (id != department.Id) { return(BadRequest()); } _context.Entry(department).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult WorklistEdit([Bind(Include = "")] work work) { if (Session["username"] == null) { return(RedirectToAction("Index", "Home")); } if (Session["uType"] == null) { return(RedirectToAction("Index", "Home")); } if (ModelState.IsValid) { Db.Entry(work).State = EntityState.Modified; Db.SaveChanges(); } return(RedirectToAction("Worklist")); }
public ActionResult MakeAdmin(int id) { if (Session["username"] == null) { return(RedirectToAction("Index", "Home")); } if (Session["uType"] == null) { return(RedirectToAction("Index", "Home")); } user user = dbContext.users.Find(id); user.type = "admin"; if (ModelState.IsValid) { dbContext.Entry(user).State = Microsoft.EntityFrameworkCore.EntityState.Modified; dbContext.SaveChanges(); return(RedirectToAction("UserList", "AdminUser")); } return(RedirectToAction("UserList", "AdminUser")); }
/// <summary> /// Update record /// </summary> /// <param name="obj"></param> public void Update(T obj) { table.Attach(obj); db.Entry(obj).State = EntityState.Modified; Save(); }
public void Update(DataHeader entity) { db.Entry(entity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }
public void Edit(T entity) { _db.Entry(entity).State = EntityState.Modified; }
public virtual void Update(TEntity entityToUpdate) { dbSet.Attach(entityToUpdate); context.Entry(entityToUpdate).State = EntityState.Modified; }
public ActionResult SaveWorkerData(HttpPostedFileBase file) { if (Session["username"] == null) { return(RedirectToAction("Index", "Home")); } if (Session["uType"] == null) { return(RedirectToAction("Index", "Home")); } var name = Request["name"]; var fathername = Request["fathername"]; var Phone = Request["Phone"]; var PresentAddress = Request["PresentAddress"]; var PermanentAddress = Request["PermanentAddress"]; //var gender = gender.Items[gender.SelectedIndex].Text; Session["tempImage"] = file; var gender = Request["gender"]; bool temporaryType = (Request["temporaryType"] == "on") ? true : false; bool permanentType = (Request["permanentType"] == "on") ? true : false; bool babyCareType = (Request["babyCareType"] == "on") ? true : false; bool elderlyCareType = (Request["elderlyCareType"] == "on") ? true : false; var area = Request["area"]; var thana = getThanaString(area); var type = getTypeString(temporaryType, permanentType, babyCareType, elderlyCareType); //var img = "defaultmaid.png"; var img = Request["img"];; System.Diagnostics.Debug.WriteLine("-----TEN-------------------------------"); System.Diagnostics.Debug.WriteLine(img); System.Diagnostics.Debug.WriteLine("-----Name-------------------------------"); if (Session["tempImage"] != null) { Session.Remove("tempImage"); var filename = Session["workerID"].ToString() + Path.GetExtension(file.FileName); var path = Path.Combine(Server.MapPath("~/Content/Workers/"), filename); file.SaveAs(path); img = filename; } /*string sql = "UPDATE worker set Name = '" + name + "', fatherName = '" + fathername + "', mobile = '" + Phone + "', PresentAddress = '" + PresentAddress + "', PermanentAddress = '" + PermanentAddress + "', gender = '" + gender + "', type = '" + type + "', Area = '" + thana + "', image = '" + img + "' where WorkerId = '" + Session["workerID"] + "'"; * DBHelper db = DBHelper.getDB(); * db.setData(sql);*/ int id = Int32.Parse(Session["workerID"].ToString()); worker worker = dbContext.worker.Find(id); worker.Name = name; worker.fatherName = fathername; worker.mobile = Phone; worker.PresentAddress = PresentAddress; worker.PermanentAddress = PermanentAddress; worker.gender = gender; worker.Area = thana; worker.type = type; worker.image = img; if (ModelState.IsValid) { dbContext.Entry(worker).State = EntityState.Modified; dbContext.SaveChanges(); //return RedirectToAction("Edit_Worker", "AdminWorker"); return(RedirectToAction("Edit_Worker", new { workerID = Session["workerID"] })); } return(RedirectToAction("Edit_Worker", new { workerID = Session["workerID"] })); }
public void Update(collect_data_view entity) { db.Entry(entity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }