示例#1
0
        public ActionResult DeleteConfirmed(int RecordID)
        {
            StorageDocumentLibrary StorageDocumentLibrary = db.StorageDocumentLibrary.Find(RecordID);

            db.StorageDocumentLibrary.Remove(StorageDocumentLibrary);
            db.SaveChanges();
            return(RedirectToAction("Index", "CandidatePersonalInfProfile"));
        }
示例#2
0
        // GET: StorageDocumentLibrary/Details/5
        public ActionResult Details(int?RecordID)
        {
            if (RecordID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StorageDocumentLibrary StorageDocumentLibrary = db.StorageDocumentLibrary.Find(RecordID);

            if (StorageDocumentLibrary == null)
            {
                return(HttpNotFound());
            }
            return(View(StorageDocumentLibrary));
        }
示例#3
0
        // GET: StorageDocumentLibrary/Edit/5
        public ActionResult Edit(int?RecordID)
        {
            ViewBag.Docutype = new SelectList(db.ListDocumentType, "DocumentTypeId", "DocumentType");
            if (RecordID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StorageDocumentLibrary StorageDocumentLibrary = db.StorageDocumentLibrary.Find(RecordID);

            if (StorageDocumentLibrary == null)
            {
                return(HttpNotFound());
            }
            return(View(StorageDocumentLibrary));
        }
示例#4
0
        public ActionResult Edit([Bind(Include = "RecordID,UserID,UserTypeID,DocName,DocumentTypeID,DocumentURL,Comments")] StorageDocumentLibrary StorageDocumentLibrary)
        {
            ViewBag.Docutype = new SelectList(db.ListDocumentType, "DocumentTypeId", "DocumentType");
            String UserID = User.Identity.GetUserId();

            StorageDocumentLibrary.UpdateDate = DateTime.Now;
            StorageDocumentLibrary.UserID     = UserID;
            if (ModelState.IsValid)
            {
                db.Entry(StorageDocumentLibrary).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "CandidatePersonalInfProfile"));
            }
            return(View(StorageDocumentLibrary));
        }
示例#5
0
        public ActionResult Create([Bind(Include = "RecordID,UserID,UserTypeID,DocumentTypeID,DocumentURL,Comments,DocName")] StorageDocumentLibrary StorageDocumentLibrary, HttpPostedFileBase file)
        {
            ViewBag.Docutype = new SelectList(db.ListDocumentType, "DocumentTypeId", "DocumentType");
            String UserID = User.Identity.GetUserId();

            StorageDocumentLibrary.UpdateDate = DateTime.Now;
            StorageDocumentLibrary.UserID     = UserID;
            StorageDocumentLibrary.UserTypeID = 1;

            if (file.ContentLength > 0)
            {
                var fileName  = Path.GetFileName(file.FileName);
                var extension = Path.GetExtension(file.FileName);
                if (extension == ".pdf" || extension == ".doc" || extension == ".docx")
                {
                    var path = Path.Combine(Server.MapPath("~/UploadedDocuments/UploadedCV/"), UserID + StorageDocumentLibrary.DocumentTypeID + "_3" + extension);
                    file.SaveAs(path);
                    ViewBag.Message = "You have not specified a file.";
                    StorageDocumentLibrary.DocumentURL = UserID + StorageDocumentLibrary.DocumentTypeID + "_3" + extension;
                    if (ModelState.IsValid)
                    {
                        db.StorageDocumentLibrary.Add(StorageDocumentLibrary);
                        db.SaveChanges();
                        return(RedirectToAction("Index", "CandidatePersonalInfProfile"));
                    }
                }
                else
                {
                    ViewBag.Docutype   = new SelectList(db.ListDocumentType, "DocumentTypeId", "DocumentType");
                    ViewBag.FileFormat = "Please note that we only accept word documents and pdf formatted files only";
                }
            }


            return(View(StorageDocumentLibrary));
        }