public void Reject(StateApprovalModel model, string username) { try { _unitOfWork.BeginTransaction(); var user = Mapper.Map<UserProfile, UserProfileItem>(_userProfileRepository.GetPersonalInformationByUserName(username)); var processRefId = UtilityService.GetStateRefId(model.StateId); _approvalService.RejectProcess(user.Id, processRefId, user.WorkFlowRefId, model.Comment); _unitOfWork.Commit(); } catch (Exception) { _unitOfWork.Rollback(); throw; } }
private string Approve(StateApprovalModel model, string approvedBy, string processRefId, State entity = null) { var user = _userProfileService.GetUserProfile(approvedBy); if (_approvalService.ApproveProcess(user.Id, processRefId, user.WorkFlowRefId, model.Comment) == null) return Approve(model.StateId, approvedBy); return null; }
public IHttpActionResult RejectState(StateApprovalModel model) { try { _stateService.Reject(model, User.Identity.Name); return Ok(); } catch (Exception) { return BadRequest(); } }
public string Approve(StateApprovalModel model, string username) { try { _unitOfWork.BeginTransaction(); var entity = _repository.Find(model.StateId); if (entity.IsApproved) throw new EdLightException("Approval process has been competed!"); var processRefId = UtilityService.GetStateRefId(model.StateId); var returnValue= Approve(model, username, processRefId, entity); _unitOfWork.Commit(); return returnValue; } catch (Exception) { _unitOfWork.Rollback(); throw; } }
public async Task<IHttpActionResult> ApproveState(StateApprovalModel model) { try { var username= _stateService.Approve(model, User.Identity.Name); if (!string.IsNullOrWhiteSpace(username)) { var roles = new List<string> {RolesConstants.StateAdmin}; var result = await CreateApplicationUser(username, roles); } return Ok(); } catch (EdLightException ex) { return BadRequest(ex.Message); } catch (Exception) { return BadRequest(); } }