Esempio n. 1
0
 public AddEditMasters Add(RIRequest rData)
 {
     try
     {
         string stProc = AddRI;
         var    pList  = new List <SqlParameter>
         {
             new SqlParameter("@TestingCHCID", rData.testingCHCId),
             new SqlParameter("@CHCID", rData.chcId),
             new SqlParameter("@PHCID", rData.phcId),
             new SqlParameter("@SCID", rData.scId),
             new SqlParameter("@RI_gov_code", rData.riGovCode),
             new SqlParameter("@RIsite", rData.riSite ?? rData.riSite),
             new SqlParameter("@Pincode", rData.pincode ?? rData.pincode),
             new SqlParameter("@ILRID", rData.ilrId),
             new SqlParameter("@Isactive", rData.isActive ?? rData.isActive),
             new SqlParameter("@Latitude", rData.latitude ?? rData.latitude),
             new SqlParameter("@Longitude", rData.longitude ?? rData.longitude),
             new SqlParameter("@Comments", rData.comments ?? rData.comments),
             new SqlParameter("@Createdby", rData.createdBy),
             new SqlParameter("@Updatedby", rData.updatedBy),
         };
         var returnData = UtilityDL.FillEntity <AddEditMasters>(stProc, pList);
         return(returnData);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 2
0
        public async Task <ActionResult> AddRI(RIRequest rData)
        {
            var addEditResponse = await _riService.Add(rData);

            return(Ok(new AddEditResponse
            {
                Status = addEditResponse.Status,
                Message = addEditResponse.Message,
            }));
        }
Esempio n. 3
0
        public async Task <AddEditResponse> Add(RIRequest rData)
        {
            var response = new AddEditResponse();

            try
            {
                if (rData.isActive.ToLower() != "true")
                {
                    rData.isActive = "false";
                }
                if (string.IsNullOrEmpty(rData.riGovCode))
                {
                    response.Status  = "false";
                    response.Message = "Please enter ri gov code";
                }
                else if (rData.phcId <= 0)
                {
                    response.Status  = "false";
                    response.Message = "Invalid PHC id";
                }
                else if (rData.scId <= 0)
                {
                    response.Status  = "false";
                    response.Message = "Invalid SC id";
                }
                else if (rData.ilrId <= 0)
                {
                    response.Status  = "false";
                    response.Message = "Invalid ILR id";
                }
                else
                {
                    var addEditResponse = _riData.Add(rData);
                    response.Status  = "true";
                    response.Message = addEditResponse.message;
                }

                return(response);
            }
            catch (Exception e)
            {
                response.Status  = "false";
                response.Message = $"Unable to process - {e.Message}";
                return(response);
            }
        }