public ActionResult UploadImage(int id)
        {
            ProjectAuth cred = check_clientRelation(id);

            if (!cred.Valid)
            {
                Redirect("/User/Index/");
            }
            Models.ProjectUploadImageViewModel updateModel = new Models.ProjectUploadImageViewModel(User.Identity.GetUserId(), cred.Entrepreneur_ID, cred.Project_ID);
            return(View(updateModel));
        }
        public ActionResult UploadImage(int id, HttpPostedFileBase upload_Image)
        {
            ProjectAuth cred = check_clientRelation(id);

            if (!cred.Valid)
            {
                Redirect("/User/Index/");
            }
            Models.ProjectUploadImageViewModel updateModel = new Models.ProjectUploadImageViewModel(User.Identity.GetUserId(), cred.Entrepreneur_ID, cred.Project_ID);
            try
            {
                // code to process a posted image file.
                byte[] picture_bytes = null;
                if (ModelState.IsValid)
                {
                    if (upload_Image != null)
                    {
                        if (upload_Image.ContentLength > 0)
                        {
                            int      MaxContentLength      = 1024 * 1024 * 3;
                            string[] AllowedFileExtensions = new string[] { ".jpg", ".gif", ".png", ".pdf" };

                            if (!AllowedFileExtensions.Contains(upload_Image.FileName.Substring(upload_Image.FileName.LastIndexOf('.'))))
                            {
                                ModelState.AddModelError("upload_Image", "Please only use file types: " + string.Join(", ", AllowedFileExtensions));
                            }
                            else if (upload_Image.ContentLength > MaxContentLength)
                            {
                                ModelState.AddModelError("upload_Image", string.Format("Your file is too large, maximum file size is: {0} Bytes.", MaxContentLength));
                            }
                            else
                            {
                                picture_bytes = new byte[upload_Image.ContentLength];
                                upload_Image.InputStream.Read(picture_bytes, 0, upload_Image.ContentLength);
                            }
                        }
                    }
                }

                updateModel.Profile_Image = picture_bytes;
                updateModel.upload_Image();
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                return(View());
            }
            return(Redirect(string.Format("/Project/Index/{0}", cred.Project_ID)));
        }