/// <summary> /// Add a new acomodation /// </summary> /// <param name="type">The type of the acomodation</param> /// <param name="address">The address of the acomodation</param> /// <param name="name">The name of the acomodaion</param> /// <param name="numberOfStars">The number of stars that the acomodation has</param> /// <param name="photo">The photo of the acomodation</param> /// <param name="description">The description of the acomodation</param> /// <param name="phoneNumber">The phone number of the acomodaion</param> /// <param name="website">The website of the acomodation</param> /// <param name="cityId">The id of the city where the acomodation is situated</param> /// <returns></returns> public Acomodation AddAcomodation(AcomodationType type, string address, string name, int numberOfStars, string description, string phoneNumber, string website, int cityId, string lat, string lng) { Acomodation accomodation = new Acomodation(type, address, name, numberOfStars, description, phoneNumber, website, cityId, lat, lng); context.Acomodations.Add(accomodation); context.SaveChanges(); return(accomodation); }
public JsonResult GetAcomodationsByType(AcomodationType type) { AcomodationService service = new AcomodationService(); var acomodations = service.GetAcomodationsByType(type); return(new JsonResult() { Data = new { Acomodations = acomodations }, ContentEncoding = Encoding.UTF8, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public Acomodation(AcomodationType Type, string Address, string Name, int NumberOfStars, string Description, string PhoneNumber, string WebSite, int CityId, string lat, string lng) { this.Type = Type; this.Address = Address; this.Name = Name; this.NumberOfStars = NumberOfStars; this.Description = Description; this.PhoneNumber = PhoneNumber; this.WebSite = WebSite; this.CityId = CityId; this.Lat = lat; this.Lng = lng; }
/// <summary> /// Returns all acomodations by type /// </summary> /// <param name="type">The type of the acomodation</param> public List <Acomodation> GetAcomodationsByType(AcomodationType type) { return(context.Acomodations.Where(a => a.Type == type).ToList()); }