Beispiel #1
0
        public IHttpActionResult CreateHotel()
        {
            var httpRequest           = HttpContext.Current.Request;
            List <MemoryStream> files = new List <MemoryStream>();

            for (var i = 0; i < HttpContext.Current.Request.Files.Count; i++)
            {
                var stream = new MemoryStream();
                HttpContext.Current.Request.Files[i].InputStream.CopyTo(stream);
                files.Add(stream);
            }
            var hotelModel =
                new JavaScriptSerializer().Deserialize <HotelModel>(HttpContext.Current.Request.Form.Get(0));

            var reurnHotel = _hotelFacade.CreateHotel(Mapper.Map <HotelDto>(hotelModel), UserId, TenantId, files,
                                                      HostingEnvironment.MapPath("~/Images/"));

            return(Ok(reurnHotel));
        }