示例#1
0
        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);
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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,
            }));
        }
示例#5
0
 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;
     }
 }