Beispiel #1
0
        public ActionResult HauledGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Models.Hauleds item)
        {
            //var model = new object[0];
            if (ModelState.IsValid)
            {
                try
                {
                    item.DateCreated = DateTime.Now;
                    item.CreatedBy   = User.Identity.GetUserId();
                    // Insert here a code to insert the new item in your model
                    unitOfWork.HauledsRepo.Insert(item);
                    unitOfWork.Save();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            var model = unitOfWork.HauledsRepo.Get(includeProperties: "Sags,ProgramOfWorks");

            return(PartialView("_HauledGridViewPartial", model));
        }
Beispiel #2
0
        public ActionResult HauledGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Models.Hauleds item)
        {
            //var model = new object[0];
            if (ModelState.IsValid)
            {
                try
                {
                    // Insert here a code to update the item in your model
                    unitOfWork.HauledsRepo.Update(item);
                    unitOfWork.Save();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            var model = unitOfWork.HauledsRepo.Get(includeProperties: "Sags,ProgramOfWorks");

            return(PartialView("_HauledGridViewPartial", model));
        }