public bool AddCancerOAR(Model.CancerOAR entity) { var validation = new CancerValidation.CancerOAREntityValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors); } using (var db = new Model.PhysicManagementEntities()) { db.CancerOAR.Add(entity); return(db.SaveChanges() == 1); } }
public bool UpdateCancerOAR(Model.CancerOAR entity) { var validation = new CancerValidation.CancerOAREntityValidate().Validate(entity); if (!validation.IsValid) { throw new ValidationException(validation.Errors); } using (var db = new Model.PhysicManagementEntities()) { var Entity = db.CancerOAR.Find(entity.Id); Entity.CancerId = entity.CancerId; Entity.Description = entity.Description; Entity.OrganTitle = entity.OrganTitle; Entity.Reserve1 = entity.Reserve1; Entity.Reserve2 = entity.Reserve2; Entity.Tolerance = entity.Tolerance; return(db.SaveChanges() == 1); } }