コード例 #1
0
 public ActionResult Create(Giftee giftee)
 {
     // TODO: Add insert logic here
     DbContext.Giftees.Add(giftee);
     DbContext.SaveChanges();
     return(RedirectToAction("Index"));
 }
コード例 #2
0
        public ActionResult Delete(Giftee giftee)
        {
            var giftGetter = DbContext.Giftees.Where(g => g.Id == giftee.Id).FirstOrDefault();

            DbContext.Giftees.Remove(giftGetter);
            DbContext.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public ActionResult Edit(Giftee giftee)
        {
            var GifteeInDB = DbContext.Giftees.Single(g => g.Id == giftee.Id);

            GifteeInDB.LengthOfRelationshipId = giftee.LengthOfRelationshipId;
            GifteeInDB.LengthOfRelationship   = giftee.LengthOfRelationship;
            GifteeInDB.TypeOfRelationship     = giftee.TypeOfRelationship;
            GifteeInDB.TypeOfRelationshipId   = giftee.TypeOfRelationshipId;
            GifteeInDB.Age        = giftee.Age;
            GifteeInDB.FirstName  = giftee.FirstName;
            GifteeInDB.LastName   = giftee.LastName;
            GifteeInDB.CategoryId = giftee.CategoryId;
            GifteeInDB.Category   = giftee.Category;
            DbContext.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
        static void Main(string[] args)
        {
            var gift   = new Gift("mixie");
            var gift1  = new Gift("washing machine");
            var giftee = new Giftee(1, "Ramu");
            var gifter = new Gifter("Sabu");

            gifter.SendGift(gift, giftee);
            gifter.SendGift(gift1, giftee);
            var res = giftee.GetAllRecievedGifts();

            foreach (var g in res)
            {
                Console.WriteLine(g);
            }
            Console.WriteLine("Hello World!");
        }
コード例 #5
0
        // GET: Giftees/Create
        public ActionResult Create()
        {
            Giftee giftee = new Giftee();

            return(View(giftee));
        }