Delete() public method

Removes one or more records from the DB according to the passed-in WHERE
public Delete ( object key = null, string where = "" ) : int
key object
where string
return int
Example #1
0
        public ActionResult Approve(int id)
        {
            dynamic user = this.users.Single(id);
            user.IsApproved = true;
            this.users.Update(user, id);

            var db = new DynamicModel("NietoYostenDb", "ApprovalRequests");
            db.Delete(where: "UserID = @0", args: id);

            NyUtil.SetAlertMessage(this, string.Format("El usuario {0} ha sido approvado.", user.Email));
            return RedirectToAction("ApprovalRequests", "Account");
        }
Example #2
0
        public ActionResult Reject(int id)
        {
            dynamic user = this.users.Single(id);

            var db = new DynamicModel("NietoYostenDb", "ApprovalRequests");
            db.Delete(where: "UserID = @0", args: id);
            this.users.Delete(id);

            NyUtil.SetAlertMessage(this, string.Format("El usuario {0} ha sido rechazado.", user.Email), AlertClass.AlertInfo);
            return RedirectToAction("ApprovalRequests", "Account");
        }