Massive.DynamicModel.Delete C# (CSharp) Method

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
        public int Delete(object key = null, string where = "", params object[] args)
        {
            var deleted = this.Single(key);
            var result = 0;
            if (BeforeDelete(deleted)) {
                result = Execute(CreateDeleteCommand(where: where, key: key, args: args));
                Deleted(deleted);
            }
            return result;
        }

Usage Example

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");
        }
All Usage Examples Of Massive.DynamicModel::Delete