예제 #1
0
        public ActionResult UploadFile(decimal id,  string floor, decimal? building_vacancy_id)
        {
            HttpPostedFileBase myFile = Request.Files["MyFile"];

            bool isUploaded = false;
            string message = "File upload failed";
            if (myFile != null && myFile.ContentLength != 0)
            {
                try
                {
                    OracleRepository repo = new OracleRepository();

                    repo.InsertOrUpdatePicture(id, building_vacancy_id, myFile.FileName, floor, User.Identity.Name, myFile.InputStream);
                    isUploaded = true;
                    message = "File uploaded successfully";

                }
                catch (Exception ex)
                {
                    message = ex.Message;
                }

            }

            return Json(new { isUploaded = isUploaded, message = message }, "text/html");
        }