Ejemplo n.º 1
0
 public AddUpdateMaster UpdateCHCDetail(UpdateCHCRequest data)
 {
     try
     {
         string stProc = UpdateCHC;
         var    pList  = new List <SqlParameter>
         {
             new SqlParameter("@Id", data.id),
             new SqlParameter("@BlockID", data.blockId),
             new SqlParameter("@DistrictID", data.districtId),
             new SqlParameter("@HNIN_ID", data.hninId ?? data.hninId),
             new SqlParameter("@CHC_gov_code", data.chcGovCode),
             new SqlParameter("@CHCname", data.name ?? data.name),
             new SqlParameter("@Istestingfacility", data.isTestingFacility),
             new SqlParameter("@TestingCHCID", data.testingCHCId),
             new SqlParameter("@CentralLabId", data.centralLabId),
             new SqlParameter("@IsActive", data.isActive),
             new SqlParameter("@Pincode", data.pincode.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;
     }
 }
Ejemplo n.º 2
0
        public async Task <IActionResult> UpdateCHC(UpdateCHCRequest sData)
        {
            _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
            _logger.LogDebug($"Request - {JsonConvert.SerializeObject(sData)}");

            var data = await _saService.UpdateCHCDetail(sData);

            _logger.LogInformation($"Response - Update CHC {data}");
            _logger.LogDebug($"Response - {JsonConvert.SerializeObject(data)}");
            return(Ok(new AddEditResponse
            {
                Status = data.Status,
                Message = data.Message,
            }));
        }
Ejemplo n.º 3
0
        public async Task <AddEditResponse> UpdateCHCDetail(UpdateCHCRequest data)
        {
            var response = new AddEditResponse();

            try
            {
                if (string.IsNullOrEmpty(data.chcGovCode))
                {
                    response.Status  = "false";
                    response.Message = "Please enter chc gov code";
                }
                else if (string.IsNullOrEmpty(data.name))
                {
                    response.Status  = "false";
                    response.Message = "Please enter chc name";
                }
                else if (data.districtId <= 0)
                {
                    response.Status  = "false";
                    response.Message = "Invalid district";
                }
                else if (data.blockId <= 0)
                {
                    response.Status  = "false";
                    response.Message = "Invalid block";
                }
                else
                {
                    var addEditResponse = _saData.UpdateCHCDetail(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);
            }
        }