public ActionResult Edit([Bind(Include = "Id,Email,PasswordHash,SecurityStamp,PhoneNumber, LockoutEndDateUtc,AccessFailedCount,UserName, FirstName,LastName,birthDate,adress,imageName,Speciality ")] Doctor d, HttpPostedFileBase Image) { //Doctor do= new Doctor(); // TODO: Add update logic here if (ModelState.IsValid) { String fileName = Path.GetFileName(Image.FileName); d.ImageName = fileName; var doctor = ds.GetMany().Single(em => em.Id == d.Id); d.PasswordHash = doctor.PasswordHash; d.SecurityStamp = doctor.SecurityStamp; db.Entry(d).State = EntityState.Modified; db.SaveChanges(); // ds.Update(d); // ds.Commit(); return(RedirectToAction("Index")); } // return RedirectToAction("Index"); return(View(d)); }
public void DetachFlats(IEnumerable <Flat> flats) { foreach (var flat in flats) { PiContext.Entry(flat).State = EntityState.Detached; } }
public ActionResult Edit([Bind(Include = "StepId,treatment,state")] Step step) { if (ModelState.IsValid) { db.Entry(step).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(step)); }
public ActionResult Edit([Bind(Include = "AppointmentId,Date,Disease,state")] Appointment appointment) { if (ModelState.IsValid) { db.Entry(appointment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(appointment)); }
public ActionResult CreateStep(string id, [Bind(Include = "StepId,treatment,state")] Step step) { int n = SC.CourseNotDone(id); if (ModelState.IsValid) { Patient p = (Patient)db.Users.Find(id); Course c = db.Courses.Find(p.course.CourseId); step.course = c; db.Steps.Add(step); // c.steps.Add(step); // SC.Update(c); db.Entry(c).State = EntityState.Modified; // SC.Commit(); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(step)); }
public ActionResult Edit([Bind(Include = "AppointmentId,Date,Location,AppointmentState, Doctor,DoctorId,Patient, PatientId")] Appointment ap) { if (ModelState.IsValid) { var appointment = SA.GetMany().Single(a => a.AppointmentId == ap.AppointmentId); ap.AppointmentState = appointment.AppointmentState; ap.Date = appointment.Date; ap.Location = ap.Location; ap.Doctor = ap.Doctor; pi.Entry(ap).State = EntityState.Modified; pi.SaveChanges(); return(RedirectToAction("Index")); } return(View(ap)); }
public virtual void Update(T entity) { dbset.Attach(entity); dataContext.Entry(entity).State = EntityState.Modified; }
public ActionResult Save(int?id, FormCollection actionValues) { var action = new DataAction(actionValues); var medecin = sm.getDoctorByUserName(AccountController.UserCoUserName); try { var changedEvent = DHXEventsHelper.Bind <Disponibility>(actionValues); changedEvent.DoctorId = medecin.Single().Id; switch (action.Type) { case DataActionTypes.Insert: { if (changedEvent.StartDate >= DateTime.Now.Date) { changedEvent.Description = "Disponible"; db.Disponibilities.Add(changedEvent); } else { Response.Write("alert('You can t add disponibility in the past')"); } } break; case DataActionTypes.Delete: if (changedEvent.DoctorId == ((sm.getDoctorByUserName(AccountController.UserCoUserName)).Single()).Id) { db.Entry(changedEvent).State = EntityState.Deleted; } else { Response.Write("alert('You can t delete disponibility of another doctor')"); } break; default: // "update" { if (changedEvent.StartDate >= DateTime.Now.Date) { if (changedEvent.DoctorId == ((sm.getDoctorByUserName(AccountController.UserCoUserName)).Single()).Id) { db.Entry(changedEvent).State = EntityState.Modified; } else { Response.Write("alert('You can t update disponibility of another doctor')"); } } else { Response.Write("alert('You can t update disponibility in the past')"); } } break; } db.SaveChanges(); action.TargetId = changedEvent.Id; } catch (Exception a) { action.Type = DataActionTypes.Error; } return(new AjaxSaveResponse(action)); }