public Place Get(int id) { PlaceDAO placeDAO = new PlaceDAO(); Place place = placeDAO.getPlace(id); return(place); }
public Place CreatePlaceAndAddress(PlaceAndAddress place) { Address adr = AddressDAO.Create(place.Address); place.Place.IdAdr = adr.Id; return(PlaceDAO.Create(place.Place)); }
public List <Place> GetCategory(String str) { PlaceDAO dvO = new PlaceDAO(); List <Place> dv = dvO.GetCategory(str); return(dv); }
public List <Place> Get(String str) { PlaceDAO dvO = new PlaceDAO(); List <Place> dv = dvO.Search2(str); return(dv); }
// GET api/<controller> public IEnumerable <Place> Get(String str) { PlaceDAO dvO = new PlaceDAO(); List <Place> dv = dvO.Search(str); return(dv); }
//En attendant de la résolution de la contrainte on delete cascade en bdd public bool DeleteWithCascade(int id) { if (!AddressDAO.Delete(PlaceDAO.Get(id).IdAdr)) { return(false); } if (!ReviewDAO.DeleteByPlace(id)) { return(false); } return(PlaceDAO.Delete(id)); }
public IEnumerable <PlaceAndAddress> GetPlacesAndAddresses() { IEnumerable <Place> places = PlaceDAO.Query(); PlaceAndAddress[] placeAndAddresses = new PlaceAndAddress[places.Count()]; int i = 0; foreach (var place in places) { placeAndAddresses[i] = new PlaceAndAddress(place, AddressDAO.Get(place.IdAdr), PlaceDAO.GetAvgRate(place.Id)); i++; } return(placeAndAddresses); }
public string ApiGetPlaceById(string id) { PlaceDAO placeDAO = new PlaceDAO(); Place selectedPlace = placeDAO.SelectPlaceById(id, out string message); if (selectedPlace == null) { return(message); } var placeToJson = JsonConvert.SerializeObject(selectedPlace); return(placeToJson); }
public IEnumerable <string> ApiGetAllPlaces(int category = 0) { PlaceDAO _placeDAO = new PlaceDAO(); List <Place> listaPlaces = _placeDAO.SelectAllPlaces(out string message, category); if (listaPlaces == null) { return new string[] { message } } ; var placesJson = JsonConvert.SerializeObject(listaPlaces); return(new string[] { placesJson }); }
public async Task <bool> Create(Place Place) { PlaceDAO PlaceDAO = new PlaceDAO(); PlaceDAO.Id = Place.Id; PlaceDAO.Name = Place.Name; PlaceDAO.PlaceGroupId = Place.PlaceGroupId; PlaceDAO.Radius = Place.Radius; PlaceDAO.Latitude = Place.Latitude; PlaceDAO.Longtitude = Place.Longtitude; PlaceDAO.CreatedAt = StaticParams.DateTimeNow; PlaceDAO.UpdatedAt = StaticParams.DateTimeNow; DataContext.Place.Add(PlaceDAO); await DataContext.SaveChangesAsync(); Place.Id = PlaceDAO.Id; await SaveReference(Place); return(true); }
public async Task <bool> Update(Place Place) { PlaceDAO PlaceDAO = DataContext.Place.Where(x => x.Id == Place.Id).FirstOrDefault(); if (PlaceDAO == null) { return(false); } PlaceDAO.Id = Place.Id; PlaceDAO.Name = Place.Name; PlaceDAO.PlaceGroupId = Place.PlaceGroupId; PlaceDAO.Radius = Place.Radius; PlaceDAO.Latitude = Place.Latitude; PlaceDAO.Longtitude = Place.Longtitude; PlaceDAO.UpdatedAt = StaticParams.DateTimeNow; await DataContext.SaveChangesAsync(); await SaveReference(Place); return(true); }
public async Task <bool> BulkMerge(List <Place> Places) { List <PlaceDAO> PlaceDAOs = new List <PlaceDAO>(); foreach (Place Place in Places) { PlaceDAO PlaceDAO = new PlaceDAO(); PlaceDAO.Id = Place.Id; PlaceDAO.Name = Place.Name; PlaceDAO.PlaceGroupId = Place.PlaceGroupId; PlaceDAO.Radius = Place.Radius; PlaceDAO.Latitude = Place.Latitude; PlaceDAO.Longtitude = Place.Longtitude; PlaceDAO.CreatedAt = StaticParams.DateTimeNow; PlaceDAO.UpdatedAt = StaticParams.DateTimeNow; PlaceDAOs.Add(PlaceDAO); } await DataContext.BulkMergeAsync(PlaceDAOs); return(true); }
public PlaceAndAddress GetPlaceAndAddress(int id) { Place place = PlaceDAO.Get(id); return(new PlaceAndAddress(place, AddressDAO.Get(place.IdAdr), PlaceDAO.GetAvgRate(id))); }
public List <Place> GetAllPlacesByCat(int catId) { PlaceDAO dao = new PlaceDAO(); return(dao.SelectByCat(catId)); }
public ActionResult <Place> Update([FromBody] Place place) { return(PlaceDAO.Update(place) ? (ActionResult <Place>)Ok() : NotFound()); }
public ActionResult Delete(int id) { string type = TokenModel.ReadClaimFromRequest(Request, "type"); return(type == "1" && PlaceDAO.Delete(id) ? (ActionResult)Ok() : BadRequest()); }
public ActionResult <Place> Get(int id) { Place place = PlaceDAO.Get(id); return(place != null ? (ActionResult <Place>)Ok(place) : NotFound("This user does not exists!")); }
public List <Place> GetBySearch(string substring) { PlaceDAO dao = new PlaceDAO(); return(dao.SearchFor(substring)); }
public Place getavgrating(int id) { PlaceDAO dao = new PlaceDAO(); return(dao.GetAvgRating(id)); }
public int deleteOne(int id) { PlaceDAO dao = new PlaceDAO(); return(dao.DeletePlace(id)); }
public List <Place> GetAllPlaces() { PlaceDAO dao = new PlaceDAO(); return(dao.GetAll()); }
public List <Place> SelectByRegion(string reg) { PlaceDAO dao = new PlaceDAO(); return(dao.selectregion(reg)); }
public List <Place> GetTop3Rating() { PlaceDAO dao = new PlaceDAO(); return(dao.gettoprating()); }
public int updateOne(int id) { PlaceDAO dao = new PlaceDAO(); return(dao.UpdatePlace(this, id)); }
public ActionResult <IEnumerable <Place> > Query() { return(Ok(PlaceDAO.Query())); }
public Place retrieveOne(int id) { PlaceDAO dao = new PlaceDAO(); return(dao.getOne(id)); }
public ActionResult <Place> Post([FromBody] Place place) { return(Ok(PlaceDAO.Create(place))); }
public int AddPlace() { PlaceDAO dao = new PlaceDAO(); return(dao.Insert(this)); }
public int updaterating(int id, double rating) { PlaceDAO dao = new PlaceDAO(); return(dao.UpdateRating(id, rating)); }