public string Add(HNINRequest hData) { try { if (hData.isActive.ToLower() != "true") { hData.isActive = "false"; } if (hData.facilityTypeId <= 0) { return("Invalid facility type id"); } if (hData.stateId <= 0) { return("Invalid state id"); } if (hData.districtId <= 0) { return("Invalid district id"); } if (hData.blockId <= 0) { return("Invalid block id"); } var result = _hninData.Add(hData); return(string.IsNullOrEmpty(result) ? $"Unable to add HNIN data" : result); } catch (Exception e) { return($"Unable to add HNIN data - {e.Message}"); } }
public ActionResult <string> Add(HNINRequest hData) { try { var hnin = _hninService.Add(hData); return(string.IsNullOrEmpty(hnin) ? $"Unable to add HNIN data" : hnin); } catch (Exception e) { return($"Unable to add HNIN data - {e.Message}"); } }
public string Add(HNINRequest hData) { try { string stProc = AddHNIN; var retVal = new SqlParameter("@Scope_output", 1); retVal.Direction = ParameterDirection.Output; var pList = new List <SqlParameter> { new SqlParameter("@Facilitytype_ID", hData.facilityTypeId), new SqlParameter("@Facility_name", hData.facilityName ?? hData.facilityName), new SqlParameter("@NIN2HFI", hData.nin2hfi ?? hData.nin2hfi), new SqlParameter("@StateID", hData.stateId), new SqlParameter("@DistrictID", hData.districtId), new SqlParameter("@Taluka", hData.taluka ?? hData.taluka), new SqlParameter("@BlockID", hData.blockId), new SqlParameter("@Address", hData.address ?? hData.address), new SqlParameter("@Pincode", hData.pincode ?? hData.pincode), new SqlParameter("@Landline", hData.landline ?? hData.landline), new SqlParameter("@Incharge_name", hData.inchargeName ?? hData.inchargeName), new SqlParameter("@Incharge_contactno", hData.inchargeContactNo ?? hData.inchargeContactNo), new SqlParameter("@Incharge_EmailId", hData.inchargeEmailId ?? hData.inchargeEmailId), new SqlParameter("@Isactive", hData.isActive ?? hData.isActive), new SqlParameter("@Latitude", hData.latitude ?? hData.latitude), new SqlParameter("@Longitude", hData.longitude ?? hData.longitude), new SqlParameter("@Comments", hData.comments ?? hData.comments), new SqlParameter("@Createdby", hData.createdBy), new SqlParameter("@Updatedby", hData.updatedBy), retVal }; UtilityDL.ExecuteNonQuery(stProc, pList); return("HNIN added successfully"); } catch (Exception e) { throw e; } }