public IHttpActionResult EditHotel() { 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)); string path = HostingEnvironment.MapPath("~/Images/") + "\\" + "Hotel-" + hotelModel.HotelId; var imageCounter = Directory.Exists(path) ? Directory .GetFiles(path) .Count(x => !Path.GetFileName(x).Contains("thumb")) : -1; var reurnHotel = _hotelFacade.EditHotel(Mapper.Map <HotelDto>(hotelModel), UserId, TenantId, files, HostingEnvironment.MapPath("~/Images/"), imageCounter); return(Ok(reurnHotel)); }