Esempio n. 1
0
        public IHttpActionResult PutCarPayment(CarPayment carPayment)
        {
            int id = carPayment.PaymentId;

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != carPayment.PaymentId)
            {
                return(BadRequest());
            }

            db.Entry(carPayment).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CarPaymentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
        public IHttpActionResult PostCarPayment(CarPayment carPayment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.CarPayments.Add(carPayment);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = carPayment.PaymentId }, carPayment));
        }
Esempio n. 3
0
        public IHttpActionResult DeleteCarPayment(int id)
        {
            CarPayment carPayment = db.CarPayments.Find(id);

            if (carPayment == null)
            {
                return(NotFound());
            }

            db.CarPayments.Remove(carPayment);
            db.SaveChanges();

            return(Ok(carPayment));
        }
Esempio n. 4
0
 public ExpensesModel()
 {
     WiFi          = new WiFi();
     Food          = new Food();
     Electricity   = new Electricity();
     Fun           = new Fun();
     Gas           = new Gas();
     GymMembership = new GymMembership();
     StudentLoans  = new Loans();
     Rent          = new Rent();
     PhoneBill     = new Phone();
     CarInsurance  = new CarInsurance();
     CarPayment    = new CarPayment();
     HuluSpotify   = new HuluSpotify();
 }
Esempio n. 5
0
 public CarPaymentModel Create(CarPayment carPayment)
 {
     return(new CarPaymentModel()
     {
         PaymentId = carPayment.PaymentId,
         CardNumber = carPayment.CardNumber,
         NameOnCard = carPayment.NameOnCard,
         Month = (int)carPayment.Month,
         Year = (int)carPayment.Year,
         CVV = carPayment.CVV,
         AddressLine1 = carPayment.AddressLine1,
         AddressLine2 = carPayment.AddressLine2,
         PostalCode = carPayment.PostalCode,
         City = carPayment.City,
         Country = carPayment.Country,
         ContactNumber = carPayment.ContactNumber,
         ClientId = (int)carPayment.ClientId,
         CC_Id = (int)carPayment.CC_Id
     });
 }