public async Task <AddEditResponse> AddStateDetail(AddStateRequest sData) { var response = new AddEditResponse(); try { if (string.IsNullOrEmpty(sData.stateGovCode)) { response.Status = "false"; response.Message = "Please enter state gov code"; } else if (string.IsNullOrEmpty(sData.name)) { response.Status = "false"; response.Message = "Please enter state name"; } else { var addEditResponse = _saData.AddStateDetail(sData); response.Status = "true"; response.Message = addEditResponse.message; } return(response); } catch (Exception e) { response.Status = "false"; response.Message = $"Unable to process - {e.Message}"; return(response); } }
public State AddState([FromBody] State state) { if (state != null) { var business = StateBusiness.Instance; var request = new AddStateRequest(this.Context); request.State = state; state = business.AddState(request); } return(state); }
public State AddState(AddStateRequest request) { State state = null; if (request != null && request.State != null) { var dataAccess = new StateDataAccess(request.Context); state = dataAccess.Add(request.State); } return(state); }
public async Task <IActionResult> AddNewState(AddStateRequest sData) { _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}"); _logger.LogDebug($"Request - {JsonConvert.SerializeObject(sData)}"); var data = await _saService.AddStateDetail(sData); _logger.LogInformation($"Response - Add New State {data}"); _logger.LogDebug($"Response - {JsonConvert.SerializeObject(data)}"); return(Ok(new AddEditResponse { Status = data.Status, Message = data.Message, })); }
public AddUpdateMaster AddStateDetail(AddStateRequest sData) { try { string stProc = AddState; var pList = new List <SqlParameter> { new SqlParameter("@State_gov_code", sData.stateGovCode ?? sData.stateGovCode), new SqlParameter("@Statename", sData.name ?? sData.name), new SqlParameter("@Shortname", sData.shortName ?? sData.shortName), new SqlParameter("@Comments", sData.comments ?? sData.comments), new SqlParameter("@UserId", sData.userId), }; var returnData = UtilityDL.FillEntity <AddUpdateMaster>(stProc, pList); return(returnData); } catch (Exception e) { throw e; } }