public async Task <IActionResult> GetSchedulesPricingById(int schedulesPricingId) { _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); var result = (await _serviceEndPoint.GetSchedulesPricing()).FirstOrDefault(p => p.SchedulesPricingId == schedulesPricingId); return(Ok(result)); }
public async Task <IActionResult> GetTransportPricing() { _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); TransportPricing[] pricing = await _serviceEndPoint.GetTransportPricing(); return(Ok(pricing)); }
public async Task <IActionResult> GetDealsPricing() { _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); DealsPricing[] deals = await _serviceEndPoint.GetDealsPricing(); return(Ok(deals)); }
public HomeController(IMailService emailService, AfricanFarmerCommoditiesUnitOfWork unitOfWork, AppSettingsConfigurations appSettings) { _emailService = emailService; _unitOfWork = unitOfWork; _applicationConstants = appSettings.AppSettings.GetSection("ApplicationConstants"); _twitterProfileFiguration = appSettings.AppSettings.GetSection("TwitterProfileFiguration"); _businessSmtpDetails = appSettings.AppSettings.GetSection("BusinessSmtpDetails"); _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); }
public async Task <IActionResult> UpdateSchedulesPricing([FromBody] SchedulesPricing schedulesPricing) { _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); bool result = await _serviceEndPoint.UpdateSchedulesPricing(schedulesPricing); if (result) { return(Ok(result)); } return(BadRequest()); }
public async Task <IActionResult> PostDealPricing([FromBody] DealsPricing dealsPricing) { _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); bool result = await _serviceEndPoint.PostDealPricing(dealsPricing); if (result) { return(Ok(result)); } return(BadRequest()); }
public async Task <IActionResult> UpdateVehicle([FromBody] Vehicle vehicle) { _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); bool result = await _serviceEndPoint.UpdateVehicle(vehicle); if (result) { return(Ok(result)); } return(BadRequest()); }
public async Task <IActionResult> PostLocation([FromBody] Location location) { _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); bool result = await _serviceEndPoint.PostLocation(location); if (result) { return(Ok(result)); } return(BadRequest()); }
public async Task <IActionResult> GetSchedulesPricing(int schedulesPricingId = -1) { _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); if (schedulesPricingId < 1) { var deal = await _serviceEndPoint.GetSchedulesPricing(); return(Ok(deal)); } else { var deal = (await _serviceEndPoint.GetSchedulesPricing()).SingleOrDefault(p => p.SchedulesPricingId == schedulesPricingId); return(Ok(deal)); } }
public async Task <IActionResult> GetTransportScheduleByVehicleId(int vehicleId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); TransportSchedule[] results = await _serviceEndPoint.GetTransportVehicleSchedulesByVehicleId(vehicleId); if (!results.Any()) { return(NotFound(results)); } return(Ok(results)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetCompanyTransporeVehicleByCompanyId(int companyId, int vehicleId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); Vehicle result = await _serviceEndPoint.GetCompanyTransporeVehicleByCompanyId(companyId, vehicleId); if (result == null) { return(NotFound(result)); } return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetAllFoodHubs() { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); FoodHub[] results = await _serviceEndPoint.GetAllFoodHubs(); if (!results.Any()) { return(NotFound(results)); } return(Ok(results)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetAllCompanyTransporeVehiclesByCompanyId(int companyId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); Vehicle[] results = await _serviceEndPoint.GetAllCompanyTransporeVehiclesByCompanyId(companyId); if (!results.Any()) { return(NotFound(results)); } return(Ok(results)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetAllFarmerCommodities(int farmerId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); Commodity[] results = await _serviceEndPoint.GetAllFarmerCommodities(farmerId); if (!results.Any()) { return(NotFound(results)); } return(Ok(results)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetFarmerCommodityById(int farmerId, int commodityId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); Commodity result = await _serviceEndPoint.GetFarmerCommodityById(farmerId, commodityId); if (result == null) { return(NotFound(result)); } return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetFoodHubById(int foodHubId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); FoodHub result = await _serviceEndPoint.GetFoodHubById(foodHubId); if (result == null) { return(NotFound(result)); } return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> UpdateCommodityUnit([FromBody] CommodityUnitViewModel commodityUnitViewModel) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); var commodityUnit = _Mapper.Map <CommodityUnit>(commodityUnitViewModel); bool result = await _serviceEndPoint.UpdateCommodityUnit(commodityUnit); if (!result) { return(NotFound(commodityUnitViewModel)); } return(Ok(new { message = "Succesfully Updated!", result = result })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetAllVehicleCategories() { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); VehicleCategory[] vehresults = await _serviceEndPoint.GetAllVehicleCategories(); VehicleCategoryViewModel[] results = _Mapper.Map <VehicleCategoryViewModel[]>(vehresults); if (!results.Any()) { return(NotFound(results)); } return(Ok(results)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> DeleteTransportSchedule([FromBody] TransportScheduleViewModel transportScheduleViewModel) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); var transportSchedule = _Mapper.Map <TransportSchedule>(transportScheduleViewModel); bool result = await _serviceEndPoint.DeleteTransportSchedule(transportSchedule); if (!result) { return(NotFound(transportScheduleViewModel)); } return(Ok(new { message = "Succesfully Deleted!", result = result })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> PostOrCreateTransportPricing([FromBody] TransportPricingViewModel transportPricingViewModel) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); var transportPricing = _Mapper.Map <TransportPricing>(transportPricingViewModel); bool result = await _serviceEndPoint.PostCreateTransportPricing(transportPricing); if (!result) { return(NotFound(transportPricingViewModel)); } return(Ok(new { message = "Succesfully Created!", result = result })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> SelectFarmer([FromBody] FarmerViewModel farmerViewModel) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); var farmer = _Mapper.Map <Farmer>(farmerViewModel); var result = await _serviceEndPoint.SelectFarmer(farmer); if (result == null) { return(NotFound(farmerViewModel)); } return(Ok(new { message = "Succesfully Selected!", result = result })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> DeleteFarmerCommodity([FromBody] CommodityViewModel commodityViewModel) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); var commodity = _Mapper.Map <Commodity>(commodityViewModel); var result = await _serviceEndPoint.DeleteFarmerCommodity(commodity); if (!result) { return(NotFound(commodity)); } return(Ok(new { message = "Succesfully Deleted!", result = result })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
//Commodities public async Task <IActionResult> GetFarmerCommodityById(int commodityId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); Commodity res = await _serviceEndPoint.GetCommodityById(commodityId); CommodityViewModel results = _Mapper.Map <CommodityViewModel>(res); if (results == null) { return(NotFound(results)); } return(Ok(results)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetAllTransportPricings() { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); TransportPricing[] results = await _serviceEndPoint.GetAllTransportPricings(); TransportPricingViewModel[] transportPricingViewModels = _Mapper.Map <TransportPricingViewModel[]>(results); if (!results.Any()) { return(NotFound(results)); } return(Ok(transportPricingViewModels)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetVehicleCategoryById(int vehicleCategoryId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); VehicleCategory tpresult = await _serviceEndPoint.GetVehicleCategoryById(vehicleCategoryId); VehicleCategoryViewModel result = _Mapper.Map <VehicleCategoryViewModel>(tpresult); if (result == null) { return(NotFound(result)); } return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> UpdateAddress([FromBody] AddressViewModel addressViewModel) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); var address = _Mapper.Map <Address>(addressViewModel); bool result = await _serviceEndPoint.UpdateAddress(address); if (!result) { return(NotFound(addressViewModel)); } return(Ok(new { message = "Succesfully Updated!", result = result })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> DeleteVehicleCategory([FromBody] VehicleCategoryViewModel vehicleCategoryViewModel) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); var vehicleCategory = _Mapper.Map <VehicleCategory>(vehicleCategoryViewModel); bool result = await _serviceEndPoint.DeleteVehicleCategory(vehicleCategory); if (!result) { return(NotFound(vehicleCategoryViewModel)); } return(Ok(new { message = "Succesfully Deleted!", result = result })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetAllCommodityUnits() { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); CommodityUnit[] comodityUnits = await _serviceEndPoint.GetAllCommodityUnits(); CommodityUnitViewModel[] results = _Mapper.Map <CommodityUnitViewModel[]>(comodityUnits); if (!results.Any()) { return(NotFound(results)); } return(Ok(results)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetTransportPricingById(int transportPricingId) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); TransportPricing tpresult = await _serviceEndPoint.GetTransportPricingById(transportPricingId); TransportPricingViewModel result = _Mapper.Map <TransportPricingViewModel>(tpresult); if (result == null) { return(NotFound(result)); } return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> SelectCommodityCategory([FromBody] CommodityCategoryViewModel commodityCategoryViewModel) { try { var _serviceEndPoint = new ServicesEndPoint(_unitOfWork, _emailService); var commodityCategory = _Mapper.Map <CommodityCategory>(commodityCategoryViewModel); CommodityCategory result = await _serviceEndPoint.SelectCommodityCategory(commodityCategory); if (result == null) { return(NotFound(commodityCategoryViewModel)); } return(Ok(new { message = "Succesfully Selected!", result = result })); } catch (Exception ex) { return(BadRequest(ex.Message)); } }