public ModifyPosStatusTerminalResponse ModifyPosStatusTerminal(ModifyPosStatusTerminalRequest request) { ModifyPosStatusTerminalResponse response = new ModifyPosStatusTerminalResponse(); PosStatusTerminal posStatusTerminal = _posStatusTerminalRepository .FindBy(request.TerminalStatusId); posStatusTerminal.Id = request.TerminalStatusId; posStatusTerminal.StatusName = request.StatusName; posStatusTerminal.PosTerminals = request.PosTerminals.ConvertToPosTerminals(); if (posStatusTerminal.GetBrokenRules().Count() > 0) { response.Errors = posStatusTerminal.GetBrokenRules().ToList(); } else { try { _posStatusTerminalRepository.Save(posStatusTerminal); _uow.Commit(); response.Errors = new List <BusinessRule>(); } catch (Exception ex) { response.Errors = new List <BusinessRule>(); response.Errors.Add(new BusinessRule("DAL", "DAL_ERROR: " + ex.Message)); } } return(response); }
public JsonResult Update(PosStatusTerminalDetailView vm) { GetPosStatusTerminalRequest request = new GetPosStatusTerminalRequest(); request.TerminalStatusId = vm.TerminalStatusId; ModifyPosStatusTerminalRequest updateRequest = _posStatusTerminalService.GetPosStatusTerminal(request).PosStatusTerminal.ConvertToModifyPosStatusTerminalRequest(); updateRequest.TerminalStatusId = vm.TerminalStatusId; updateRequest.StatusName = vm.StatusName; ModifyPosStatusTerminalResponse response = _posStatusTerminalService.ModifyPosStatusTerminal(updateRequest); return(Json(response)); }