public virtual void Delete(TEntity entityToDelete) { if (context.Entry(entityToDelete).State == EntityState.Detached) { dbSet.Attach(entityToDelete); } dbSet.Remove(entityToDelete); }
public IHttpActionResult PutEmployeeClass(int id, EmployeeClass employeeClass) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employeeClass.Id) { return(BadRequest()); } db.Entry(employeeClass).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployeeClassExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutLastMonth(int id, LastMonth lastMonth) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != lastMonth.Id) { return(BadRequest()); } db.Entry(lastMonth).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LastMonthExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutP2_Record(int id, P1_Record p1_Record) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != p1_Record.r_id) { return(BadRequest()); } db.Entry(p1_Record).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!P1_RecordExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void Update(User_Book obj) { using (ProjectEntities db = new ProjectEntities()) { db.User_Book.Attach(obj); db.Entry(obj).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } }
public ActionResult Edit([Bind(Include = "CargoID,CType,HazPer,WRate,DRate")] Cargo cargo) { if (ModelState.IsValid) { db.Entry(cargo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cargo)); }
public ActionResult Edit([Bind(Include = "CustomerID,CName,ConNum,Adrs,PostAdrs,Email")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "StatusID,StatusName")] Status status) { if (ModelState.IsValid) { db.Entry(status).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(status)); }
public ActionResult Edit([Bind(Include = "PojectId,BusinessId,Name,Description,Preview")] AspNetProject aspNetProject) { if (ModelState.IsValid) { db.Entry(aspNetProject).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(aspNetProject)); }
public ActionResult Edit([Bind(Include = "UrgencyID,UrgencyName,UrgencyDescription")] Urgency urgency) { if (ModelState.IsValid) { db.Entry(urgency).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(urgency)); }
public ActionResult Edit([Bind(Include = "proj_id,title,price,duration,descr,attachment,req_languages,posted_by")] project project) { if (ModelState.IsValid) { db.Entry(project).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(project)); }
public ActionResult Edit([Bind(Include = "DepartmentID,DepartmentName")] Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(department)); }
public ActionResult Edit([Bind(Include = "Id,Name,Description")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "Id,RoleName,Code")] Role role) { if (ModelState.IsValid) { db.Entry(role).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(role)); }
public ActionResult Edit([Bind(Include = "TruckID,Vin,LP,Tstat,Make,Model,Chassis,Cabin,Engine,Steering,Powert,Torque,GearBox,TankCap,Milage,Weightt,MaxLoad,PDate,LSD,GarageID")] Truck truck) { if (ModelState.IsValid) { db.Entry(truck).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.GarageID = new SelectList(db.Garages, "GarageID", "Adrs", truck.GarageID); return(View(truck)); }
public ActionResult Edit([Bind(Include = "Id,UserName,Password,RoleId,Name,Created_at,Updated_at,Address")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RoleId = new SelectList(db.Role, "Id", "RoleName", user.RoleId); return(View(user)); }
public ActionResult Edit([Bind(Include = "ServiceID,SDate,Engine,PF,Trans,Chassis,cabin,WT,Brakes,Cost,TruckID")] ServiceHistory serviceHistory) { if (ModelState.IsValid) { db.Entry(serviceHistory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TruckID = new SelectList(db.Trucks, "TruckID", "Vin", serviceHistory.TruckID); return(View(serviceHistory)); }
public ActionResult Edit([Bind(Include = "Id,UserId,OrderCode,Created_at,Updated_at,Status")] Order order) { if (ModelState.IsValid) { db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.User, "Id", "UserName", order.UserId); return(View(order)); }
public ActionResult Edit([Bind(Include = "ProfileID,ProfileName,DepartmentID")] Profile profile) { if (ModelState.IsValid) { db.Entry(profile).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DepartmentID = new SelectList(db.Departments, "DepartmentID", "DepartmentName", profile.DepartmentID); return(View(profile)); }
public async Task <ActionResult> Edit([Bind(Include = "deptID,name,location")] Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(department)); }
public ActionResult Edit([Bind(Include = "Id,Name,CateId,Price,Description")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CateId = new SelectList(db.Category, "Id", "Name", product.CateId); return(View(product)); }
public ActionResult Edit([Bind(Include = "UserID,UserEmail,UserPassword,UserLastActivity,UserName,ProfileID")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProfileID = new SelectList(db.Profiles, "ProfileID", "ProfileName", user.ProfileID); return(View(user)); }
public async Task <ActionResult> Edit([Bind(Include = "guardianID,guardianName,relationship,mobileNumber")] Guardian guardian) { if (ModelState.IsValid) { db.Entry(guardian).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index", "Students")); } return(View(guardian)); }
public async Task <ActionResult> Edit([Bind(Include = "courseCode,name,theoryHours,labHours")] Subject subject) { if (ModelState.IsValid) { db.Entry(subject).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(subject)); }
public async Task <ActionResult> Edit([Bind(Include = "dicipID,name,deptID,totalSemester")] Dicipline dicipline) { if (ModelState.IsValid) { db.Entry(dicipline).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.deptID = new SelectList(db.Departments, "deptID", "name", dicipline.deptID); return(View(dicipline)); }
public async Task <ActionResult> Edit([Bind(Include = "sessionID,name,dicipID,year")] Session session) { if (ModelState.IsValid) { db.Entry(session).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.dicipID = new SelectList(db.Diciplines, "dicipID", "name", session.dicipID); return(View(session)); }
public ActionResult Edit([Bind(Include = "Id,ProductId,Quantity,OrderId,Price")] OrderDetail orderDetail) { if (ModelState.IsValid) { db.Entry(orderDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrderId = new SelectList(db.Order, "Id", "OrderCode", orderDetail.OrderId); ViewBag.ProductId = new SelectList(db.Product, "Id", "Name", orderDetail.ProductId); return(View(orderDetail)); }
public async Task <ActionResult> Edit([Bind(Include = "teacherID,name,email,username")] Teacher teacher) { if (ModelState.IsValid) { db.Entry(teacher).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.username = new SelectList(db.Userinfoes, "username", "password", teacher.username); return(View(teacher)); }
public ActionResult Edit([Bind(Include = "commentid,user_id,game_id,download_id,content,comment_time")] comment comment) { if (ModelState.IsValid) { db.Entry(comment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.download_id = new SelectList(db.download, "downloadid", "downloadid", comment.download_id); ViewBag.game_id = new SelectList(db.game, "gameid", "game_name", comment.game_id); ViewBag.user_id = new SelectList(db.userinfo, "userid", "username", comment.user_id); return(View(comment)); }
public async Task <ActionResult> Edit([Bind(Include = "classID,name,sectionID,sessionID,isMorning,isTheory,isSupply")] Class @class) { if (ModelState.IsValid) { db.Entry(@class).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.sectionID = new SelectList(db.Sections, "sectionID", "name", @class.sectionID); ViewBag.sessionID = new SelectList(db.Sessions, "sessionID", "name", @class.sessionID); return(View(@class)); }