コード例 #1
0
        public ActionResult Index()
        {
            FREELANCER_DOC_INFO_Model doc = null;

            if (User.Identity.GetUserId() != null)
            {
                doc = _iFreelancerDocService.GetFreelancerDocById(User.Identity.GetUserId());
            }
            return(View(doc));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Freelancer_Id,NID_Path,Picture_Path,PVC_Path")] FREELANCER_DOC_INFO_Model fREELANCER_DOC_INFO_Model)
 {
     if (ModelState.IsValid)
     {
         if (_iFreelancerDocService.UpdateFreelancerDoc(fREELANCER_DOC_INFO_Model))
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(fREELANCER_DOC_INFO_Model));
 }
コード例 #3
0
        public ActionResult Edit(string id)
        {
            if (User.Identity.GetUserId() == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FREELANCER_DOC_INFO_Model fREELANCER_DOC_INFO_Model = _iFreelancerDocService.GetFreelancerDocById(User.Identity.GetUserId());

            if (fREELANCER_DOC_INFO_Model == null)
            {
                return(HttpNotFound());
            }
            return(View(fREELANCER_DOC_INFO_Model));
        }
コード例 #4
0
        public ActionResult Create(HttpPostedFileBase photo, HttpPostedFileBase nid, HttpPostedFileBase pvc)
        {
            FREELANCER_DOC_INFO_Model fREELANCER_DOC_INFO_Model = new FREELANCER_DOC_INFO_Model();

            fREELANCER_DOC_INFO_Model.Freelancer_Id = User.Identity.GetUserId();

            if (photo != null)
            {
                string ext = Path.GetExtension(photo.FileName);
                if (ext == ".jpg" || ext == ".png")
                {
                    string photoPath = Path.Combine(Server.MapPath("~/UploadFiles/"), Path.GetFileName(User.Identity.GetUserId() + "_photo" + ext));
                    photo.SaveAs(photoPath);
                    fREELANCER_DOC_INFO_Model.Picture_Path = "~/UploadFiles/" + User.Identity.GetUserId() + "_photo" + ext;
                }
                else
                {
                    ViewBag.ValidationMsg = "File Extension of Photo Should be .jpg or .png";
                    return(RedirectToAction("Create"));
                }
            }
            if (nid != null)
            {
                string ext = Path.GetExtension(nid.FileName);
                if (ext == ".jpg" || ext == ".png")
                {
                    string nidPath = Path.Combine(Server.MapPath("~/UploadFiles/"), Path.GetFileName(User.Identity.GetUserId() + "_nid" + ext));
                    nid.SaveAs(nidPath);
                    fREELANCER_DOC_INFO_Model.NID_Path = "~/UploadFiles/" + User.Identity.GetUserId() + "_nid" + ext;
                }
                else
                {
                    ViewBag.ValidationMsg = "File Extension of NID Should be .jpg or .png";
                    return(RedirectToAction("Create"));
                }
            }
            if (pvc != null)
            {
                string ext = Path.GetExtension(pvc.FileName);
                if (ext == ".jpg" || ext == ".png")
                {
                    string pvcPath = Path.Combine(Server.MapPath("~/UploadFiles/"), Path.GetFileName(User.Identity.GetUserId() + "_pvc" + ext));
                    pvc.SaveAs(pvcPath);
                    fREELANCER_DOC_INFO_Model.PVC_Path = "~/UploadFiles/" + User.Identity.GetUserId() + "_pvc" + ext;
                }
                else
                {
                    ViewBag.ValidationMsg = "File Extension of PVC Should be .jpg or .png";
                    return(RedirectToAction("Create"));
                }
            }


            if (_iFreelancerDocService.InsertFreelancerDoc(fREELANCER_DOC_INFO_Model))
            {
                return(RedirectToAction("Index"));
            }


            return(View(fREELANCER_DOC_INFO_Model));
        }