public BaseApiResponse AddOrUpdateCountry(int UserId, CountryMasterModel CountryObj) { var response = new BaseApiResponse(); try { var countryIDParam = new SqlParameter { ParameterName = "p_CountryID", DbType = DbType.Int32, Value = (object)CountryObj.CountryID }; var CountryNameParam = new SqlParameter { ParameterName = "p_CountryName", DbType = DbType.String, Value = (object)CountryObj.CountryName }; var RegionIDParam = new SqlParameter { ParameterName = "p_SelectedRegion", DbType = DbType.String, Value = (object)CountryObj.SelectedRegion }; var UserIdParam = new SqlParameter { ParameterName = "p_UserId", DbType = DbType.Int32, Value = UserId }; var IsActiveParam = new SqlParameter { ParameterName = "p_IsActive", DbType = DbType.Boolean, Value = (Object)CountryObj.IsActive != null ? CountryObj.IsActive : (object)DBNull.Value }; var result = 0; if (CountryObj.CountryID > 0) { result = _repository.ExecuteSQL <int>("usp_CountryMaster_update", countryIDParam, CountryNameParam, RegionIDParam, UserIdParam, IsActiveParam).FirstOrDefault(); } else { result = _repository.ExecuteSQL <int>("usp_CountryMaster_insert", countryIDParam, CountryNameParam, RegionIDParam, UserIdParam, IsActiveParam).FirstOrDefault(); } response.Success = result > 0; response.InsertedId = result; } catch (Exception ex) { _logger.Error(ex); response.Message.Add(ex.Message); } return(response); }
public BaseApiResponse AddOrUpdateCountry(int UserId, CountryMasterModel CountryObj) { return(this._iCountryService.AddOrUpdateCountry(UserId, CountryObj)); }