示例#1
0
        public ActionResult DeleteConfirmed(int id)
        {
            bool ok = AccountTypeRepository.Delete(id);

            if (ok)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Delete", id));
            }
        }
        // DELETE api/AccountTypeAPI/5
        public HttpResponseMessage DeleteAccountType(int id)
        {
            AccountType accounttype = db.GetById(id);

            if (accounttype == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            try
            {
                db.Delete(accounttype);
            }
            catch (Exception)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, accounttype));
        }