public async Task <ActionResult <CommonAPIResponse <bool> > > AddCity(CityAddDTO CityAddDTO) { #region Declare return type with initial value. JsonResult jsonResult = GetDefaultJsonResult <bool>(); #endregion try { #region Validate AddCity for nullability before prepaing the response. if (await CityAppService.AddCity(CityAddDTO)) { jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.Success, CurrentLanguagId), true, HttpStatusCode.OK); } else { jsonResult = JsonResultResponse(CommonHelper.GetResponseMessage(APIResponseMessage.InvalidCredentials, CurrentLanguagId), false, HttpStatusCode.BadRequest); } #endregion } catch (Exception exception) { } return(jsonResult); }
/// <summary> /// Add City AppService /// </summary> /// <returns>bool<bool></returns> public async Task <bool> AddCity(CityAddDTO cityAddDTO) { #region Declare a return type with initial value. bool isCreated = false; #endregion try { if (cityAddDTO != null) { isCreated = await CityBusinessMapping.AddCity(cityAddDTO); } } catch (Exception exception) {} return(isCreated); }
/// <summary> /// Mapping user Action Actitvity Log /// </summary> /// <param name=></ param > /// <returns>Task<City></returns> public City MappingCityAddDTOToCity(CityAddDTO CityAddDTO) { #region Declare a return type with initial value. City City = null; #endregion try { City = new City { CityName = CityAddDTO.CityName, CountyId = CityAddDTO.CountyId, CreationDate = DateTime.Now, IsDeleted = (byte)DeleteStatusEnum.NotDeleted }; } catch (Exception exception) { } return(City); }
/// <summary> /// Create User Action Activity Log /// </summary> /// <param name=></param> /// <returns>bool</returns> public async Task <bool> AddCity(CityAddDTO CityAddDTO) { #region Declare a return type with initial value. bool isCityCreated = default(bool); #endregion try { #region Vars City City = null; #endregion City = CityMapping.MappingCityAddDTOToCity(CityAddDTO); if (City != null) { await UnitOfWork.CityRepository.Insert(City); isCityCreated = await UnitOfWork.Commit() > default(int); } } catch (Exception exception) { } return(isCityCreated); }