Beispiel #1
0
        public async Task <AddEditResponse> Add(CasteRequest cData)
        {
            var response = new AddEditResponse();

            try
            {
                if (cData.isActive.ToLower() != "true")
                {
                    cData.isActive = "false";
                }
                if (string.IsNullOrEmpty(cData.casteName))
                {
                    response.Status  = "false";
                    response.Message = "Please enter caste name";
                }
                else
                {
                    var addEditResponse = _casteData.Add(cData);
                    response.Status  = "true";
                    response.Message = addEditResponse.message;
                }
                return(response);
            }
            catch (Exception e)
            {
                response.Status  = "false";
                response.Message = $"Unable to process - {e.Message}";
                return(response);
            }
        }
Beispiel #2
0
        public async Task <ActionResult> Add(CasteRequest cData)
        {
            _logger.LogInformation($"Invoking endpoint: {this.HttpContext.Request.GetDisplayUrl()}");
            _logger.LogDebug($"Request - Adding caste data - {JsonConvert.SerializeObject(cData)}");
            var addEditResponse = await _casteService.Add(cData);

            _logger.LogInformation($" Add Caste {addEditResponse}");
            _logger.LogDebug($"Response - Adding caste data - {JsonConvert.SerializeObject(addEditResponse)}");
            return(Ok(new AddEditResponse
            {
                Status = addEditResponse.Status,
                Message = addEditResponse.Message,
            }));
        }
Beispiel #3
0
 public AddEditMasters Add(CasteRequest cData)
 {
     try
     {
         string stProc = AddCaste;
         var    pList  = new List <SqlParameter>
         {
             new SqlParameter("@Castename", cData.casteName ?? cData.casteName),
             new SqlParameter("@Isactive", cData.isActive ?? cData.isActive),
             new SqlParameter("@Comments", cData.comments ?? cData.comments),
             new SqlParameter("@Createdby", cData.createdBy),
             new SqlParameter("@Updatedby", cData.updatedBy),
         };
         var returnData = UtilityDL.FillEntity <AddEditMasters>(stProc, pList);
         return(returnData);
     }
     catch (Exception e)
     {
         throw e;
     }
 }