Esempio n. 1
0
 public ActionResult UploadImage(string fname, HttpPostedFileBase img)
 {
     if (Request.HttpMethod == "POST")
     {
         Validation_Classes.Validation v1 = new Validation();
         if (img != null)
         {
             if (v1.IsImageFormat(fname))
             {
                 LeaveBusinessLayer lb = new LeaveBusinessLayer();
                 Employee           e1 = (LeaveApplication.Models.Employee)Session["Employee"];
                 e1.ImageBytes = lb.GetFileBytes(img);
                 ProfilePicture p1 = new ProfilePicture()
                 {
                     Image = e1.ImageBytes
                 };
                 p1.Update(int.Parse(Session["EmpId"].ToString()));
                 return(Content("Successfully Uploaded"));
             }
             else
             {
                 return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, "Invalid image format"));
             }
         }
     }
     return(View());
 }