示例#1
0
 public AddUpdateMaster AddSCDetail(AddSCRequest data)
 {
     try
     {
         string stProc = AddSC;
         var    pList  = new List <SqlParameter>
         {
             new SqlParameter("@CHCID", data.chcId),
             new SqlParameter("@PHCID", data.phcId),
             new SqlParameter("@SC_gov_code", data.scGovCode),
             new SqlParameter("@SCname", data.name ?? data.name),
             new SqlParameter("@HNIN_ID", data.hninId ?? data.hninId),
             new SqlParameter("@Pincode", data.pincode.ToCheckNull()),
             new SqlParameter("@SCAddress", data.scAddress.ToCheckNull()),
             new SqlParameter("@Latitude", data.latitude.ToCheckNull()),
             new SqlParameter("@Longitude", data.longitude.ToCheckNull()),
             new SqlParameter("@Comments", data.comments.ToCheckNull()),
             new SqlParameter("@UserId", data.userId),
         };
         var returnData = UtilityDL.FillEntity <AddUpdateMaster>(stProc, pList);
         return(returnData);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#2
0
        public async Task <IActionResult> AddNewSC(AddSCRequest sData)
        {
            _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
            _logger.LogDebug($"Request - {JsonConvert.SerializeObject(sData)}");

            var data = await _saService.AddSCDetail(sData);

            _logger.LogInformation($"Response - Add New SC {data}");
            _logger.LogDebug($"Response - {JsonConvert.SerializeObject(data)}");
            return(Ok(new AddEditResponse
            {
                Status = data.Status,
                Message = data.Message,
            }));
        }
示例#3
0
        public async Task <AddEditResponse> AddSCDetail(AddSCRequest data)
        {
            var response = new AddEditResponse();

            try
            {
                if (string.IsNullOrEmpty(data.scGovCode))
                {
                    response.Status  = "false";
                    response.Message = "Please enter sc gov code";
                }
                else if (string.IsNullOrEmpty(data.name))
                {
                    response.Status  = "false";
                    response.Message = "Please enter sc name";
                }
                else if (data.chcId <= 0)
                {
                    response.Status  = "false";
                    response.Message = "Invalid chc";
                }
                else if (data.phcId <= 0)
                {
                    response.Status  = "false";
                    response.Message = "Invalid phc";
                }
                else
                {
                    var addEditResponse = _saData.AddSCDetail(data);
                    response.Status  = "true";
                    response.Message = addEditResponse.message;
                }
                return(response);
            }
            catch (Exception e)
            {
                response.Status  = "false";
                response.Message = $"Unable to process - {e.Message}";
                return(response);
            }
        }