public IHttpActionResult PutPaymentType(int id, PaymentType paymentType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != paymentType.Id)
            {
                return(BadRequest());
            }

            //db.Entry(paymentType).State = EntityState.Modified;

            try
            {
                _paymentTypeRepository.Update(paymentType);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PaymentTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "Id,NamePaymentType")] PaymentType paymentType)
 {
     if (ModelState.IsValid)
     {
         paymentTypeRepository.Update(paymentType);
         return(RedirectToAction("Index"));
     }
     return(View(paymentType));
 }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "Id,Name")] PaymentType paymentType)
 {
     if (ModelState.IsValid)
     {
         //db.Entry(paymentType).State = EntityState.Modified;
         //db.SaveChanges();
         _paymentTypeRepository.Update(paymentType);
         return(RedirectToAction("Index"));
     }
     return(View(paymentType));
 }