Пример #1
0
        public ServiceResultModel <bool> SaveTestFile(HotelTestFileVM model, string mapPath)
        {
            string fileName      = string.Empty;
            string fileExtension = string.Empty;

            if (model != null)
            {
                HttpPostedFileBase file = model.HotelImage;

                fileName      = Path.GetFileNameWithoutExtension(file.FileName);
                fileExtension = Path.GetExtension(file.FileName);

                string fullName = Path.Combine(mapPath, $"{fileName}_{DateTime.Now.Ticks}{fileExtension}");

                file.SaveAs(fullName);
            }

            return(ServiceResultModel <bool> .OK(true));
        }
Пример #2
0
        public JsonResult SaveTestFile(HotelTestFileVM model)
        {
            ServiceResultModel <bool> serviceResult = _hotelService.SaveTestFile(model, Server.MapPath("~/App_Data/uploads"));

            return(Json(""));
        }