Example #1
0
        public string UpdateTourPrice(TourPriceModel tourPrice)
        {
            Tour_Price newTourPrice = db.Tour_Price.FirstOrDefault(tp => tp.Id == tourPrice.Id);

            newTourPrice.Date    = tourPrice.Date;
            newTourPrice.ID_Tour = tourPrice.TourId;
            newTourPrice.Price   = tourPrice.Price;


            db.Entry(newTourPrice).State = System.Data.Entity.EntityState.Modified;

            if (db.SaveChanges() > 0)
            {
                return("更新成功");
            }

            return("更新失败");
        }
Example #2
0
        public string AddTourPrice(TourPriceModel tourPriceModel)
        {
            Tour_Price newTourPrice = new Tour_Price()
            {
                Id      = Guid.NewGuid().ToString(),
                Date    = tourPriceModel.Date,
                Price   = tourPriceModel.Price,
                ID_Tour = tourPriceModel.TourId
            };

            db.Tour_Price.Add(newTourPrice);

            if (db.SaveChanges() > 0)
            {
                return("添加成功");
            }

            return("添加失败");
        }