public async Task <ActionResult> Create([Bind(Include = "EmployeeID,ReferenceDoc,FileName,FileDescription")] T_EmployeeDocument t_EmployeeDocument) { if (ModelState.IsValid) { if (!string.IsNullOrEmpty(Request.Files["FileName"].FileName)) { string FolderPath = Server.MapPath(Resources.HRMResources.EmployeeDocumentPath); // + "\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek; string FullPathWithFileName = FolderPath + "\\" + Request.Files["FileName"].FileName; string FolderPathForImage = Request.Files["FileName"].FileName; //"\\" + DateTime.Now.Year + "_" + DateTime.Now.Month + "_" + DateTime.Now.Day + "_" + DateTime.Now.DayOfWeek + "\\" + Request.Files["StdProfilePicPath"].FileName; if (CommonFunction.IsFolderExist(FolderPath)) { Request.Files["FileName"].SaveAs(FullPathWithFileName); t_EmployeeDocument.FileName = FolderPathForImage; } } t_EmployeeDocument.EmployeeID = Session["LoginUserID"].ToString(); t_EmployeeDocument.CreatedBy = Session["LoginUserID"].ToString(); t_EmployeeDocument.CreatedDate = DateTime.Now; t_EmployeeDocument.ModifiedBy = Session["LoginUserID"].ToString(); t_EmployeeDocument.ModifiedDate = DateTime.Now; t_EmployeeDocument.Active = true; db.T_EmployeeDocument.Add(t_EmployeeDocument); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.EmployeeID = new SelectList(db.M_EmployeeMasters, "EmployeeID", "EmployeeName", t_EmployeeDocument.EmployeeID); return(View(t_EmployeeDocument)); }
public async Task <ActionResult> DeleteConfirmed(int id) { T_EmployeeDocument t_EmployeeDocument = await db.T_EmployeeDocument.FindAsync(id); db.T_EmployeeDocument.Remove(t_EmployeeDocument); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
// GET: T_EmployeeDocument/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } T_EmployeeDocument t_EmployeeDocument = await db.T_EmployeeDocument.FindAsync(id); if (t_EmployeeDocument == null) { return(HttpNotFound()); } return(View(t_EmployeeDocument)); }
public async Task <ActionResult> Edit([Bind(Include = "DocumentID,EmployeeID,ReferenceDoc,FileName,FileDescription,CreatedBy,CreatedDate,Active")] T_EmployeeDocument t_EmployeeDocument) { if (ModelState.IsValid) { t_EmployeeDocument.ModifiedBy = Session["LoginUserID"].ToString(); t_EmployeeDocument.ModifiedDate = DateTime.Now; db.Entry(t_EmployeeDocument).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.EmployeeID = new SelectList(db.M_EmployeeMasters, "EmployeeID", "EmployeeName", t_EmployeeDocument.EmployeeID); return(View(t_EmployeeDocument)); }
// GET: T_EmployeeDocument/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } T_EmployeeDocument t_EmployeeDocument = await db.T_EmployeeDocument.FindAsync(id); if (t_EmployeeDocument == null) { return(HttpNotFound()); } ViewBag.EmployeeID = new SelectList(db.M_EmployeeMasters, "EmployeeID", "EmployeeName", t_EmployeeDocument.EmployeeID); return(View(t_EmployeeDocument)); }