コード例 #1
0
        // GET: EMP_Designation/Create
        public ActionResult Create()
        {
            ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName");
            EMP_Designation eMP_Designation = new EMP_Designation();

            return(View("Edit", eMP_Designation));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            EMP_Designation eMP_Designation = db.EMP_Designation.Find(id);

            db.EMP_Designation.Remove(eMP_Designation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
        // GET: EMP_Designation/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EMP_Designation eMP_Designation = db.EMP_Designation.Find(id);

            if (eMP_Designation == null)
            {
                return(HttpNotFound());
            }
            return(View(eMP_Designation));
        }
コード例 #4
0
        // GET: EMP_Designation/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EMP_Designation eMP_Designation = db.EMP_Designation.Find(id);

            if (eMP_Designation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", eMP_Designation.UserID);
            return(View(eMP_Designation));
        }
コード例 #5
0
        public ActionResult Create([Bind(Include = "DesignationID,Designation,Remarks,Created,Modified,UserID")] EMP_Designation eMP_Designation)
        {
            if (ModelState.IsValid)
            {
                eMP_Designation.Created  = DateTime.Now;
                eMP_Designation.Modified = DateTime.Now;
                if (Session["UserID"] != null)
                {
                    eMP_Designation.UserID = Convert.ToInt16(Session["UserID"].ToString());
                }
                db.EMP_Designation.Add(eMP_Designation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.UserID = new SelectList(db.SEC_User, "UserID", "UserName", eMP_Designation.UserID);
            return(View(eMP_Designation));
        }