public IResult Quit(Worker worker) { try { var userRole = _userRoleDal.Get(ur => ur.UserId == worker.WorkerId); userRole.RoleId = 1; _userRoleDal.Update(userRole); worker.QuitDate = DateTime.Now; _workerDal.Update(worker); return(new SuccessResult()); } catch (Exception) { return(new ErrorResult(Messages.ErrorWhileUpdatingEntity)); } }
public bool Update(Worker worker) { WorkerValidator validator = new WorkerValidator(); var result = validator.Validate(worker); if (result.Errors.Count > 0) { throw new ValidationException(result.Errors); } return(_workerDal.Update(worker)); }
public IResult UpdateStatus(Worker worker) { _workerDal.Update(worker); return(new SuccessResult(Messages.WorkerUpdated)); }