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)); }
public JsonResult SaveTestFile(HotelTestFileVM model) { ServiceResultModel <bool> serviceResult = _hotelService.SaveTestFile(model, Server.MapPath("~/App_Data/uploads")); return(Json("")); }