Example #1
0
        public ActionResult Passwords_Destroy([DataSourceRequest]DataSourceRequest request, Password password)
        {
            if (ModelState.IsValid)
            {
                var entity = new Password
                {
                    BusinessEntityID = password.BusinessEntityID,
                    PasswordHash = password.PasswordHash,
                    PasswordSalt = password.PasswordSalt,
                    rowguid = password.rowguid,
                    ModifiedDate = password.ModifiedDate
                };

                db.Passwords.Attach(entity);
                db.Passwords.Remove(entity);
                db.SaveChanges();
            }

            return Json(new[] { password }.ToDataSourceResult(request, ModelState));
        }
Example #2
0
        public ActionResult Passwords_Update([DataSourceRequest]DataSourceRequest request, Password password)
        {
            if (ModelState.IsValid)
            {
                var entity = new Password
                {
                    BusinessEntityID = password.BusinessEntityID,
                    PasswordHash = password.PasswordHash,
                    PasswordSalt = password.PasswordSalt,
                    rowguid = password.rowguid,
                    ModifiedDate = DateTime.Now
                };

                db.Passwords.Attach(entity);
                db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }

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