// GET: ClientMasters/Edit/5
        public ActionResult Edit(int?id)
        {
            ViewBag.ClientStatusList = StatusList.ClientStatus;

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClientMaster clientMaster = db.ClientMasters.Find(id);

            if (clientMaster == null)
            {
                return(HttpNotFound());
            }

            var viewModel = new ClientMasterEditModel
            {
                ClientID     = clientMaster.ClientID,
                ClientName   = clientMaster.ClientName,
                ClientDescr  = clientMaster.ClientDescr,
                ClientStatus = clientMaster.ClientStatus,
                UserMod      = clientMaster.UserMod,
                DateModified = clientMaster.DateModified,
                DateAdded    = clientMaster.DateAdded,
            };

            return(View(viewModel));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ClientMaster clientMaster = db.ClientMasters.Find(id);

            db.ClientMasters.Remove(clientMaster);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        // GET: ClientMasters/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClientMaster clientMaster = db.ClientMasters.Find(id);

            if (clientMaster == null)
            {
                return(HttpNotFound());
            }
            return(View(clientMaster));
        }
        public ActionResult Edit(ClientMasterEditModel viewModel)
        {
            if (ModelState.IsValid)
            {
                ClientMaster model = new ClientMaster();

                model.ClientID     = viewModel.ClientID;
                model.ClientName   = viewModel.ClientName;
                model.ClientDescr  = viewModel.ClientDescr;
                model.ClientStatus = viewModel.ClientStatus;
                model.UserMod      = User.Identity.GetAppUserId();
                model.DateModified = DateTime.Now;
                model.DateAdded    = viewModel.DateAdded;

                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(viewModel));
        }