Ejemplo n.º 1
0
        public ActionResult peAppWvRules_Create([DataSourceRequest] DataSourceRequest request, peAppWvRule peAppWvRule)
        {
            if (ModelState.IsValid)
            {
                var entity = new peAppWvRule
                {
                    code       = peAppWvRule.code,
                    itemname   = peAppWvRule.itemname,
                    value1     = peAppWvRule.value1,
                    value2     = peAppWvRule.value2,
                    type       = peAppWvRule.type,
                    WorkerType = peAppWvRule.WorkerType
                };

                wvmDb.peAppWvRules.Add(entity);
                wvmDb.SaveChanges();
                peAppWvRule.Id = entity.Id;
            }

            return(Json(new[] { peAppWvRule }.ToDataSourceResult(request, ModelState)));
        }
Ejemplo n.º 2
0
        public ActionResult peAppWvRules_Update([DataSourceRequest] DataSourceRequest request, peAppWvRule peAppWvRule)
        {
            if (ModelState.IsValid)
            {
                var entity = new peAppWvRule
                {
                    Id         = peAppWvRule.Id,
                    code       = peAppWvRule.code,
                    itemname   = peAppWvRule.itemname,
                    value1     = peAppWvRule.value1,
                    value2     = peAppWvRule.value2,
                    type       = peAppWvRule.type,
                    WorkerType = peAppWvRule.WorkerType
                };

                wvmDb.peAppWvRules.Attach(entity);
                wvmDb.Entry(entity).State = EntityState.Modified;
                wvmDb.SaveChanges();
            }

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