Example #1
0
        public ActionResult Add()
        {
            WorkSubtypeView workSubtypeView = new WorkSubtypeView();

            workSubtypeView.BindDDLs(workSubtypeView, db);

            return(View(workSubtypeView));
        }
Example #2
0
        public ActionResult Edit(int?workSubtypePK)
        {
            if (workSubtypePK != null)
            {
                IWorkSubtypesRepository workSubtypesRepository = new WorkSubtypesRepository(db);
                WorkSubtype             workSubtype            = workSubtypesRepository.GetWorkSubtypeByPK((int)workSubtypePK);
                WorkSubtypeView         workSubtypeView        = new WorkSubtypeView();

                workSubtypeView.ConvertFrom(workSubtype, workSubtypeView);
                workSubtypeView.BindDDLs(workSubtypeView, db);

                return(View(workSubtypeView));
            }
            else
            {
                return(RedirectToAction("Index", "WorkSubtype"));
            }
        }
Example #3
0
        public ActionResult Edit(WorkSubtypeView workSubtypeView, FormCollection form)
        {
            if (ModelState.IsValid)
            {
                IWorkSubtypesRepository workSubtypesRepository = new WorkSubtypesRepository(db);
                WorkSubtype             workSubtype            = workSubtypesRepository.GetWorkSubtypeByPK((int)workSubtypeView.WorkSubtypePK);

                workSubtypeView.ConvertTo(workSubtypeView, workSubtype);

                workSubtypesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", workSubtype.WorkSubtypePK);

                return(RedirectToAction("Index", "WorkSubtype"));
            }
            else
            {
                workSubtypeView.BindDDLs(workSubtypeView, db);

                return(View(workSubtypeView));
            }
        }