Exemple #1
0
        public ActionResult BlottersGridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Models.Blotters item)
        {
            item.BlotterId = new IdHelpers().BlotterId;
            if (ModelState.IsValid)
            {
                try
                {
                    // Insert here a code to insert the new item in your model
                    unitOfWork.BlottersRepo.Insert(item);
                    unitOfWork.Save();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }

            var model = unitOfWork.BlottersRepo.Get();

            return(PartialView("_BlottersGridViewPartial", model));
        }
Exemple #2
0
        public ActionResult BlottersGridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Models.Blotters item)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    // Insert here a code to update the item in your model
                    unitOfWork.BlottersRepo.TrackModifiedEntities(m => m.Id == item.Id, item);
                    unitOfWork.BlottersRepo.Update(item);
                    unitOfWork.Save();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            var model = unitOfWork.BlottersRepo.Get();

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