public string Save(Staff user, string CurrentUsername) { if (FindById(user.Id, CurrentUsername) == null) { if (LoginService.FindByUsername(user.StaffId, CurrentUsername) == null) { if (DepartmentService.FindById(user.Department.Id, CurrentUsername) != null) { if (IsValisImage(user)) { user.PersonalInformation.Image = FileHandler.SaveImage(user.PersonalInformation.ImageFile); user.Login.IsActive = Status.Enable; return(StaffRepository.Save(user) ? null : Messages.IssueInDatabase); } else { return(Messages.InvalidImage); } } else { return(Messages.ProgramNotFound); } } else { return(Messages.usernameExist); } } else { return(Messages.IdExist); } }
private void SaveMethod() { _staffRepository.Save(Staff); var user = ApplicationState.GetValue <UserAcc>("User"); ILogFactory logFactory = new LogFactory(); var logEntity = logFactory.CreateMessage(user, Staff); var repository = new Repository <Log>(); repository.Save(logEntity); CloseAction(); }