Ejemplo n.º 1
0
        public ActionResult Edit([Bind(Include = "ID,Type")] AccountType accountType)
        {
            bool isOk = TryUpdateModel(accountType);

            if (ModelState.IsValid && isOk)
            {
                AccountTypeRepository.Update(accountType);
                return(RedirectToAction("Index"));
            }

            return(View(accountType));
        }
        // PUT api/AccountTypeAPI/5
        public HttpResponseMessage PutAccountType(int id, AccountType accounttype)
        {
            if (ModelState.IsValid && id == accounttype.Id)
            {
                try
                {
                    db.Update(accounttype);
                }
                catch (Exception)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound));
                }

                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }
        }