public async Task <ApiResponse <IEnumerable <int> > > PutCategorySearchAsync(int IdService, int city_id, string keyword, [FromBody] Categories categories) { try { List <Restaurant> listR = new List <Restaurant>(); _restaurantService.GetExternalServiceById(IdService); if (categories.categories == null) { return(ApiUtil <IEnumerable <int> > .CreateSuccessfulResult( new int[] {} )); } if (categories.categories.Count() < 1) { listR = await _restaurantService.GetRestaurantsByKeywordAsync(city_id, keyword); } List <RestaurantCategory> newList = new List <RestaurantCategory>(); JsonDtoMapper <RestaurantCategory> map = new JsonDtoMapper <RestaurantCategory>(); foreach (var category in categories.categories)//get the fisrt catalogue { newList.Add(map.ToDto(category)); } listR = await _restaurantService.GetRestaurantsByCategoriesKeywordAsync(city_id, newList, keyword); return(ApiUtil <IEnumerable <int> > .CreateSuccessfulResult( listR.Select(l => Int32.Parse(l.restaurant_id)) )); } catch (Exception e) { return(ApiUtil <IEnumerable <int> > .CreateFailResult(e.ToString())); } }
// PUT: api/Delivery/5 public async Task <ApiResponse <List <DeliveryInfos> > > Put(int IdService, int city_id, [FromBody] ListRestaurant data) { try { _deliveryService.GetExternalServiceById(IdService); List <Restaurant> newList = new List <Restaurant>(); if (data.restaurant_ids.Count() < 1) { ApiUtil <List <DeliveryInfos> > .CreateFailResult(""); } foreach (var id in data.restaurant_ids)//get the fisrt catalogue { Restaurant item = new Restaurant(); item.restaurant_id = id.ToString(); newList.Add(item); } return(ApiUtil <List <DeliveryInfos> > .CreateSuccessfulResult( await _deliveryService.GetRestaurantsDeliveryInforAsync(city_id, newList) )); } catch (Exception e) { return(ApiUtil <List <DeliveryInfos> > .CreateFailResult(e.ToString())); } }
public ApiResponse <IEnumerable <Services.Models.EventModel> > GetAllOrder() { try { var result = _eventService.GetAllEvent(); return(ApiUtil <IEnumerable <Services.Models.EventModel> > .CreateSuccessfulResult(result)); } catch (Exception e) { return(ApiUtil <IEnumerable <Services.Models.EventModel> > .CreateFailResult(e.ToString())); } }
public ApiResponse AddEventListItem(string Id, [FromBody] EventListItem item) { try { _spListService.AddEventListItem(Id, item); return(ApiUtil.CreateSuccessfulResult()); } catch (Exception e) { return(ApiUtil.CreateFailResult(e.ToString())); } }
public ApiResponse <List <FavoriteRestaurant> > GetAllById(string userId) { try { var favoriteRestaurants = _favoriteService.GetFavoriteRestaurantsById(userId); return(ApiUtil <List <FavoriteRestaurant> > .CreateSuccessfulResult(favoriteRestaurants)); } catch (Exception e) { return(ApiUtil <List <FavoriteRestaurant> > .CreateFailResult(e.ToString())); } }
public ApiResponse Remove([FromBody] FavoriteRestaurant favoriteRestaurant) { try { _favoriteService.RemoveFavoriteRestaurant(favoriteRestaurant); return(ApiUtil.CreateSuccessfulResult()); } catch (Exception e) { return(ApiUtil.CreateFailResult(e.ToString())); } }
public ApiResponse <Services.Models.EventModel> GetEvent(int id) { try { var result = _eventService.GetEvent(id); return(ApiUtil <Services.Models.EventModel> .CreateSuccessfulResult(result)); } catch (Exception e) { return(ApiUtil <Services.Models.EventModel> .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse> AddListItem(string Id, [FromBody] JSONRequest item) { try { await _spListService.AddListItem(Id, item); return(ApiUtil.CreateSuccessfulResult()); } catch (Exception e) { return(ApiUtil.CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <string> > GetGroups() { try { var group = await _sPUserService.GetGroups(); return(ApiUtil <string> .CreateSuccessfulResult(group)); } catch (Exception e) { return(ApiUtil <string> .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <Model.Domain.User> > GetUserById(string Id) { try { var user = await _sPUserService.GetUserById(Id); return(ApiUtil <Model.Domain.User> .CreateSuccessfulResult(user)); } catch (Exception e) { return(ApiUtil <Model.Domain.User> .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse> GetIdsAsync(string eventId) { try { string html = System.IO.File.ReadAllText(@"D:\Training project\Project\FOS2\fos\fos-api\FOS\FOS.API\App_Data\email_template.txt"); await _sendEmailService.SendEmailAsync(eventId, html); return(ApiUtil.CreateSuccessfulResult()); } catch (Exception e) { return(ApiUtil.CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <DeliveryInfos> > GetFirstIdAsync(int IdService, int city_id, int restaurant_id) { try { _deliveryService.GetExternalServiceById(IdService); return(ApiUtil <DeliveryInfos> .CreateSuccessfulResult( await _deliveryService.GetRestaurantFirstDeliveryInforAsync(city_id, restaurant_id) )); } catch (Exception e) { return(ApiUtil <DeliveryInfos> .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <List <Food> > > GetFoodAsync(int IdService, int delivery_id, int dish_type_id) { try { _foodService.GetExternalServiceById(IdService); return(ApiUtil <List <Food> > .CreateSuccessfulResult( await _foodService.GetFoodFromCatalogueAsync(delivery_id, dish_type_id) )); } catch (Exception e) { return(ApiUtil <List <Food> > .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <List <DeliveryInfos> > > GetPageDeliveryAsync(int IdService, int city_id, int pagenum, int pagesize) { try { _deliveryService.GetExternalServiceById(IdService); return(ApiUtil <List <DeliveryInfos> > .CreateSuccessfulResult( await _deliveryService.GetRestaurantDeliveryInforByPagingAsync(city_id, pagenum, pagesize) )); } catch (Exception e) { return(ApiUtil <List <DeliveryInfos> > .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <List <RestaurantCategory> > > GetMetadataCategoryAsync(int IdService) { try { _restaurantService.GetExternalServiceById(IdService); return(ApiUtil <List <RestaurantCategory> > .CreateSuccessfulResult( await _restaurantService.GetMetadataForCategoryAsync() )); } catch (Exception e) { return(ApiUtil <List <RestaurantCategory> > .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <Province> > GetByIdAsync(int IdService, int id) { try { _provinceService.GetExternalServiceById(IdService); return(ApiUtil <Province> .CreateSuccessfulResult( await _provinceService.GetMetadataByIdAsync(id) )); } catch (Exception e) { return(ApiUtil <Province> .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <IEnumerable <int> > > GetByKeywordLimitAsync(int IdService, int city_id, string keyword, int limit) { try { _restaurantService.GetExternalServiceById(IdService); return(ApiUtil <IEnumerable <int> > .CreateSuccessfulResult( (await _restaurantService.GetRestaurantsByKeywordAsync(city_id, keyword)).Select(l => Int32.Parse(l.restaurant_id)).Take(limit) )); } catch (Exception e) { return(ApiUtil <IEnumerable <int> > .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <IEnumerable <int> > > GetIdsAsync(int IdService, int province_id) { try { _restaurantService.GetExternalServiceById(IdService); return(ApiUtil <IEnumerable <int> > .CreateSuccessfulResult( (await _restaurantService.GetRestaurantsByProvinceAsync(province_id)).Select(l => Int32.Parse(l.restaurant_id)) )); } catch (Exception e) { return(ApiUtil <IEnumerable <int> > .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <Restaurant> > GetByIdAsync(int IdService, int province_id, int restaurant_id) { try { _restaurantService.GetExternalServiceById(IdService); return(ApiUtil <Restaurant> .CreateSuccessfulResult( await _restaurantService.GetRestaurantsByIdAsync(province_id, restaurant_id) )); } catch (Exception e) { return(ApiUtil <Restaurant> .CreateFailResult(e.ToString())); } }
public async Task <ApiResponse <DeliveryDetail> > GetRestaurantDetailAsync(int IdService, int delivery_id) { try { _deliveryService.GetExternalServiceById(IdService); return(ApiUtil <DeliveryDetail> .CreateSuccessfulResult( await _deliveryService.GetRestaurantDetailAsync(new Restaurant() { delivery_id = delivery_id.ToString() }) )); } catch (Exception e) { return(ApiUtil <DeliveryDetail> .CreateFailResult(e.ToString())); } }