public bool AddContour(Model.Contour entity) { var validtion = new ContourValidation.ContourEntityValidate().Validate(entity); if (!validtion.IsValid) { throw new ValidationException(validtion.Errors); } using (var db = new Model.PhysicManagementEntities()) { db.Contour.Add(entity); return(db.SaveChanges() == 1); } }
//public object SetContourAsAcceptedByDoctor(long countorId) //{ // var UserData = Logic.Services.AuthenticatedUserService.GetUserId(); // using (var db = new Model.PhysicManagementEntities()) // { // var Entity = db.Contour.Find(countorId); // Entity.ModifyDate = DateTime.Now; // Entity.DoctorUserId = UserData.UserId.ToString(); // Entity.DoctorFullName = UserData.FullName; // return db.SaveChanges() == 1; // } //} public bool UpdateContour(Model.Contour entity) { var validtion = new ContourValidation.ContourEntityValidate().Validate(entity); if (!validtion.IsValid) { throw new ValidationException(validtion.Errors); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.Contour.Find(entity.Id); Entity.DoctorDescription = entity.DoctorDescription; Entity.ResidentDescription = entity.ResidentDescription; Entity.DoctorFullName = entity.DoctorFullName; Entity.ActionDate = entity.ActionDate; Entity.DoctorUserId = entity.DoctorUserId; Entity.IsAccepted = entity.IsAccepted; Entity.ModifyDate = entity.ModifyDate; return(db.SaveChanges() == 1); } }