Ejemplo n.º 1
0
        public IHttpActionResult PutUser_Trip_Payment(int id, User_Trip_Payment user_Trip_Payment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != user_Trip_Payment.srno)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public IHttpActionResult PostUser_Trip_Payment(User_Trip_Payment user_Trip_Payment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.User_Trip_Payment.Add(user_Trip_Payment);

            try
            {
                db.SaveChanges();
                User_Trips ut    = db.User_Trips.Where(t => t.userid == user_Trip_Payment.tripId).FirstOrDefault();
                string     smsto = ut.DriverMobileNo + "," + ut.DriverOwnerMobNo;
                User       us    = db.Users.Where(u => u.srno == Convert.ToInt32(user_Trip_Payment.userno)).FirstOrDefault();
                string     smsmsg;
                smsmsg = "Dear Customer, Rs. " + user_Trip_Payment.TripPaymentAmount + " Paid via " + user_Trip_Payment.TripPaymentMode + "for Trip Id -" + user_Trip_Payment.tripId;
                ns.sendsms("smsfrom", smsto, smsmsg);
                ns.sendemail(us.userEmail, "", "TollPay.IN Trip Booked", smsmsg);
            }
            catch (DbUpdateException)
            {
                if (User_Trip_PaymentExists(user_Trip_Payment.srno))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = user_Trip_Payment.srno }, user_Trip_Payment));
        }
Ejemplo n.º 3
0
        public IHttpActionResult DeleteUser_Trip_Payment(int id)
        {
            User_Trip_Payment user_Trip_Payment = db.User_Trip_Payment.Find(id);

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

            db.User_Trip_Payment.Remove(user_Trip_Payment);
            db.SaveChanges();

            return(Ok(user_Trip_Payment));
        }