Esempio n. 1
0
 public ActionResult Create([Bind(Include = "Id,NamePaymentType")] PaymentType paymentType)
 {
     if (ModelState.IsValid)
     {
         paymentTypeRepository.Add(paymentType);
         return(RedirectToAction("Index"));
     }
     return(View(paymentType));
 }
        public IHttpActionResult PostPaymentType(PaymentType paymentType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            //db.PaymentType.Add(paymentType);
            //db.SaveChanges();
            _paymentTypeRepository.Add(paymentType);

            return(CreatedAtRoute("DefaultApi", new { id = paymentType.Id }, paymentType));
        }