public void Reject(LgaApprovalModel model, string username) { try { _unitOfWork.BeginTransaction(); var user = Mapper.Map<UserProfile, UserProfileItem>(_userProfileRepository.GetPersonalInformationByUserName(username)); var processRefId = UtilityService.GetLgaRefId((int) model.LgaId); _approvalService.RejectProcess(user.Id, processRefId, user.WorkFlowRefId, model.Comment); _unitOfWork.Commit(); } catch (Exception) { _unitOfWork.Rollback(); throw; } }
private string Approve(LgaApprovalModel model, string approvedBy, string processRefId, Lga entity = null) { var user = _userProfileService.GetUserProfile(approvedBy); if (_approvalService.ApproveProcess(user.Id, processRefId, user.WorkFlowRefId, model.Comment) == null) return Approve((int) model.LgaId, (int)model.StateId, approvedBy); return null; }
public IHttpActionResult RejectLga(LgaApprovalModel model) { try { _lgaService.Reject(model, User.Identity.Name); return Ok(); } catch (Exception) { return BadRequest(); } }
public string Approve(LgaApprovalModel model, string username) { try { _unitOfWork.BeginTransaction(); var entity = _repository.Find(model.LgaId); if ((bool) entity.IsApproved) throw new EdLightException("Approval process has been competed!"); var processRefId = UtilityService.GetLgaRefId((int) model.LgaId); var returnValue = Approve(model, username, processRefId, entity); _unitOfWork.Commit(); return returnValue; }catch (Exception) { _unitOfWork.Rollback(); throw; } }
public async Task<IHttpActionResult> ApproveLga(LgaApprovalModel model) { try { var username = _lgaService.Approve(model, User.Identity.Name); return Ok(); } catch (EdLightException ex) { return BadRequest(ex.Message); } catch (Exception) { return BadRequest(); } }