public void Update(TEntity entity) { if (entity == null) { throw new ArgumentNullException("entity"); } var local = Dbset.Local.ToList(); foreach (var efloc in local) { if (GetPropValue(efloc, "Id").Equals(GetPropValue(entity, "Id"))) { _dataContext.Entry(efloc).State = EntityState.Detached; } } Dbset.Attach(entity); _dataContext.Entry(entity).State = EntityState.Modified; }
public ActionResult Edit(Department department) { if (ModelState.IsValid) { _context.Entry(department).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); } return(RedirectToAction("Index")); }
public void SaveStudent(Student student) { using (var context = new ProjectDbContext()) { context.Entry(student.Department).State = System.Data.Entity.EntityState.Unchanged; context.Students.Add(student); context.SaveChanges(); } }
public void EmailConfirm(Guid id) { var mode = _context.Users.Find(id); var model = mode; model.IsVerified = true; _context.Entry(mode).CurrentValues.SetValues(model); _context.SaveChanges(); }
public ActionResult Edit([Bind(Include = "cat_id,cat_name,status,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 = "CategoryPostId,CategoryName")] CategoryPost categoryPost) { if (ModelState.IsValid) { db.Entry(categoryPost).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(categoryPost)); }
public ActionResult Edit([Bind(Include = "Id,Code,Name")] Departments departments) { if (ModelState.IsValid) { db.Entry(departments).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(departments)); }
public ActionResult Edit([Bind(Include = "Id,Username,Password,UserRole")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Edit([Bind(Include = "RoomId,RoomNo")] Room room) { if (ModelState.IsValid) { db.Entry(room).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(room)); }
public ActionResult Edit([Bind(Include = "DirectorId,DirectorName,ImageURL,DateOfBirth,NetWorth,Nationality,Education")] Director director) { if (ModelState.IsValid) { db.Entry(director).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(director)); }
public ActionResult Edit([Bind(Include = "CinemaId,CinemaName,ImageURL,FoundingDate,NetWorth,CEO,Rating")] Cinema cinema) { if (ModelState.IsValid) { db.Entry(cinema).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cinema)); }
public ActionResult Edit([Bind(Include = "cus_id,cus_name,email,password,phone,address,status,create_date")] Customer customer) { if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit([Bind(Include = "Id,Name,Description,TimeSpentInMinutes")] TaskModel taskModel) { if (ModelState.IsValid) { db.Entry(taskModel).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(taskModel)); }
public ActionResult Edit([Bind(Include = "Id,Name,CodeName,Description,StartDate,EndDate,Duration,UploadFile,Status")] Projct projct) { if (ModelState.IsValid) { db.Entry(projct).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(projct)); }
public ActionResult Edit([Bind(Include = "Id,Title,Body,UserRoleAssignedTo")] Document document) { if (ModelState.IsValid) { db.Entry(document).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(document)); }
public ActionResult Edit(Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(department)); }
public ActionResult Edit([Bind(Include = "pub_id,pub_name,Description")] Publisher publisher) { if (ModelState.IsValid) { db.Entry(publisher).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(publisher)); }
public ActionResult Edit([Bind(Include = "id,UniversityName,City,PostalCode,StreetAddress,Country")] User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Edit([Bind(Include = "GradeId,GradeName")] Grade grade) { if (ModelState.IsValid) { db.Entry(grade).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(grade)); }
public ActionResult Edit([Bind(Include = "ProjectId,ProjectName,StartDate,FinishDate")] Project project) { if (ModelState.IsValid) { db.Entry(project).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(project)); }
public ActionResult Edit([Bind(Include = "DesignationId,TeacherDesignation")] Designation designation) { if (ModelState.IsValid) { db.Entry(designation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(designation)); }
public ActionResult Edit([Bind(Include = "SemesterId,SemesterName")] Semester semester) { if (ModelState.IsValid) { db.Entry(semester).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(semester)); }
public ActionResult Edit([Bind(Include = "SubjectId,SubjectName")] Subject subject) { if (ModelState.IsValid) { db.Entry(subject).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(subject)); }
public ActionResult Edit([Bind(Include = "Id,Name,Email,Password,Department,Gender,Address")] Student student) { if (ModelState.IsValid) { db.Entry(student).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student)); }
public ActionResult Edit([Bind(Include = "DepartmentId,DepartmentName,DepartmentCode")] Department department) { if (ModelState.IsValid) { db.Entry(department).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(department)); }
public ActionResult Edit([Bind(Include = "DayId,Name")] Day day) { if (ModelState.IsValid) { db.Entry(day).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(day)); }
public ActionResult Edit([Bind(Include = "CompanyId,CompanyName,ImageURL,NetWorth,FoundingDate,Country,AnnualIncome")] Company company) { if (ModelState.IsValid) { db.Entry(company).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(company)); }
public IActionResult EditArtist(Artist upload, IFormFile file) { if (file == null || file.Length < 0) { upload.ImagePath = upload.ImagePath; } else { var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/images", file.FileName); using (var stream = new FileStream(path, FileMode.Create)) { file.CopyTo(stream); } upload.ImagePath = file.FileName; } _context.Entry(upload).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("ArtistList")); }
public ActionResult Edit([Bind(Include = "EnrollCourseId,RegistrationId,CourseId,EnrollDate,GradeName")] EnrollCourse enrollcourse) { if (ModelState.IsValid) { db.Entry(enrollcourse).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(db.Courses, "CourseId", "CourseCode", enrollcourse.CourseId); return(View(enrollcourse)); }
public async Task <ActionResult> Edit([Bind(Include = "DepartmentId,DepartmentCode,DepartmentName")] Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(department)); }