コード例 #1
0
        public ActionResult CutHair(int id)
        {
            var     db      = new SalonContext();
            Client  client  = db.client.Find(id);
            Stylist stylist = db.stylist.Find(client.stylist);

            stylist.CutHair(client.id);
            client = db.client.Find(id);
            if (client.hair <= 0)
            {
                //Client died
                db.client.Remove(client);
                stylist.GetDrop();
                db.SaveChanges();
                return(RedirectToAction("Replace", "Stylist", new { id = stylist.id }));
            }
            return(RedirectToAction("Show", new { id = id }));
        }