Пример #1
0
        public ActionResult Editing_Read([DataSourceRequest] DataSourceRequest request)
        {
            ApplicationDbContext       db           = new ApplicationDbContext();
            ProductionUnitOwnerService ownerService = new ProductionUnitOwnerService(db);

            var rslt = ownerService.GetAll().OrderByDescending(ev => ev.pioneerCitizenName);

            return(Json(rslt.ToDataSourceResult(request)));
        }
Пример #2
0
        public ActionResult Editing_Update([DataSourceRequest] DataSourceRequest request, ProductionUnitOwnerViewModel currentOwner)
        {
            ApplicationDbContext       db           = new ApplicationDbContext();
            ProductionUnitOwnerService ownerService = new ProductionUnitOwnerService(db);

            if (currentOwner != null)
            {
                ownerService.Update(currentOwner);
            }

            return(Json(new[] { currentOwner }.ToDataSourceResult(request, ModelState)));
        }
Пример #3
0
        public ActionResult Editing_Create([DataSourceRequest] DataSourceRequest request, ProductionUnitOwnerViewModel currentOwner)
        {
            ApplicationDbContext       db = new ApplicationDbContext();
            ProductionUnitOwnerService productionUnitOwnerService = new ProductionUnitOwnerService(db);

            if (ModelState.IsValid)
            {
                productionUnitOwnerService.Create(currentOwner);
            }

            return(Json(new[] { currentOwner }.ToDataSourceResult(request, ModelState)));
        }
Пример #4
0
        public ActionResult Editing_Destroy([DataSourceRequest] DataSourceRequest request, ProductionUnitOwnerViewModel currentOwner)
        {
            ApplicationDbContext       db           = new ApplicationDbContext();
            ProductionUnitOwnerService ownerService = new ProductionUnitOwnerService(db);

            if (currentOwner != null)
            {
                if (currentOwner.user != null)
                {
                    ModelState.AddModelError("inUse", new Exception("[[[Production Unit Owner already in use]]]"));
                }

                ownerService.Destroy(currentOwner);
            }

            return(Json(new[] { currentOwner }.ToDataSourceResult(request, ModelState)));
        }