public ActionResult Edit([Bind(Include = "CassettsID,CassettsNo,Capacity,CompanyID,UserID,Created,Modified,Remarks,StatusID")] DIA_Cassett dIA_Cassett)
 {
     if (dIA_Cassett.CassettsID > 0)
     {
         if (dIA_Cassett.Remarks == null || dIA_Cassett.Remarks == "")
         {
             ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", dIA_Cassett.CompanyID);
             ViewBag.StatusID  = new SelectList(db.SYS_Status, "StatusID", "StatusName", dIA_Cassett.StatusID);
             ViewBag.UserID    = new SelectList(db.SEC_User, "UserID", "UserName", dIA_Cassett.UserID);
             ModelState.AddModelError("", "Enter Remarks");
             return(View(dIA_Cassett));
         }
     }
     if (ModelState.IsValid)
     {
         db.Entry(dIA_Cassett).State = EntityState.Modified;
         dIA_Cassett.Modified        = Convert.ToDateTime(DateTime.Now);
         if (Session["UserID"] != null)
         {
             dIA_Cassett.UserID = Convert.ToInt16(Session["UserID"].ToString());
         }
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", dIA_Cassett.CompanyID);
     ViewBag.StatusID  = new SelectList(db.SYS_Status, "StatusID", "StatusName", dIA_Cassett.StatusID);
     ViewBag.UserID    = new SelectList(db.SEC_User, "UserID", "UserName", dIA_Cassett.UserID);
     return(View(dIA_Cassett));
 }
        public ActionResult DeleteConfirmed(int id)
        {
            DIA_Cassett dIA_Cassett = db.DIA_Cassett.Find(id);

            db.DIA_Cassett.Remove(dIA_Cassett);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: DIA_Cassett/Create
        public ActionResult Create()
        {
            ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName");
            ViewBag.StatusID  = new SelectList(db.SYS_Status, "StatusID", "StatusName");
            ViewBag.UserID    = new SelectList(db.SEC_User, "UserID", "UserName");
            DIA_Cassett _dIA_Cassett = new DIA_Cassett();

            return(View("Edit", _dIA_Cassett));
        }
        // GET: DIA_Cassett/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DIA_Cassett dIA_Cassett = db.DIA_Cassett.Find(id);

            if (dIA_Cassett == null)
            {
                return(HttpNotFound());
            }
            return(View(dIA_Cassett));
        }
        // GET: DIA_Cassett/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DIA_Cassett dIA_Cassett = db.DIA_Cassett.Find(id);

            if (dIA_Cassett == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", dIA_Cassett.CompanyID);
            ViewBag.StatusID  = new SelectList(db.SYS_Status, "StatusID", "StatusName", dIA_Cassett.StatusID);
            ViewBag.UserID    = new SelectList(db.SEC_User, "UserID", "UserName", dIA_Cassett.UserID);
            return(View(dIA_Cassett));
        }
        public ActionResult Create([Bind(Include = "CassettsID,CassettsNo,Capacity,CompanyID,UserID,Created,Modified,Remarks,StatusID")] DIA_Cassett dIA_Cassett)
        {
            if (ModelState.IsValid)
            {
                dIA_Cassett.Created  = DateTime.Now;
                dIA_Cassett.Modified = DateTime.Now;
                if (Session["UserID"] != null)
                {
                    dIA_Cassett.UserID = Convert.ToInt16(Session["UserID"].ToString());
                }
                db.DIA_Cassett.Add(dIA_Cassett);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CompanyID = new SelectList(db.SYS_Company, "CompanyID", "CompanyName", dIA_Cassett.CompanyID);
            ViewBag.StatusID  = new SelectList(db.SYS_Status, "StatusID", "StatusName", dIA_Cassett.StatusID);
            ViewBag.UserID    = new SelectList(db.SEC_User, "UserID", "UserName", dIA_Cassett.UserID);
            return(View(dIA_Cassett));
        }