コード例 #1
0
        public ActionResult ProcessingEmployee(string EmployeeNumber, string FullName, string Email, string Address, DateTime DateBirth, string Phone, string Images, string RegistrationNumber, HttpPostedFileBase fileUpload)
        {
            HttpPostedFileBase uploadedFile = Request.Files["fileUpload"];

            if (uploadedFile.ContentLength == 0)
            {
                em.EditEm(EmployeeNumber, FullName, DateTime.Now, Email, Address, DateBirth, Phone, Images, RegistrationNumber);
                return(RedirectToAction("ManageEmployee"));
            }
            if (uploadedFile.ContentLength > 0)
            {
                var fileName = Path.GetFileName(fileUpload.FileName);
                var path     = Path.Combine(Server.MapPath("~/Content/Upload"), fileName);
                fileUpload.SaveAs(path);
                em.EditEm(EmployeeNumber, FullName, DateTime.Now, Email, Address, DateBirth, Phone, uploadedFile.FileName, RegistrationNumber);
            }
            return(RedirectToAction("ManageEmployee"));
        }