示例#1
0
        public async Task <ActionResult> ChangePaid(int id, bool value)
        {
            Invoices invoices = await db.Invoices.FindAsync(id);

            if (invoices == null)
            {
                return(Json(new { Success = false }));
            }
            invoices.paid            = value;
            db.Entry(invoices).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(Json(new { Success = true }));
        }
示例#2
0
        public async Task <ActionResult> Edit([Bind(Include = "userName,hashPassword,permissionGroup")] UserAccount useraccount)
        {
            if (ModelState.IsValid)
            {
                UserAccount acct = await db.UserAccounts.FindAsync(useraccount.userName);

                if (acct == null)
                {
                    return(HttpNotFound());
                }
                if (acct.permissionGroup == "Boss" && !LDAPHelper.UserIsMemberOfGroupOC("Boss", User.Identity.Name))
                {
                    return(HttpNotFound());
                }
                //hash the password with the apps secret key
                useraccount.hashPassword    = EncryptionHelper.Encrypt(useraccount.hashPassword);
                db.Entry(useraccount).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(useraccount));
        }