Esempio n. 1
0
        public void Delete(int id)
        {
            Caddy c = utOfWork.CaddyRepository.GetById(id);

            utOfWork.CaddyRepository.Delete(c);
            utOfWork.Commit();
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Caddy caddy = db.Caddy.Find(id);

            db.Caddy.Remove(caddy);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "Id,xPos,yPos,zPos,State,ClientId")] Caddy caddy)
 {
     if (ModelState.IsValid)
     {
         db.Entry(caddy).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ClientId = new SelectList(db.Client, "Id", "Name", caddy.ClientId);
     return(View(caddy));
 }
Esempio n. 4
0
        // POST: odata/Caddies
        public IHttpActionResult Post(Caddy caddy)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Caddy.Add(caddy);
            db.SaveChanges();

            return(Created(caddy));
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            Player player1 = new Player("Harvey", ClubType.GRAPHITE, BallType.MAXFLI, GloveType.CALLOWAY);
            Player player2 = new Player("Penick", ClubType.STEEL, BallType.SRIXON, GloveType.FOOTJOY);
            Caddy  caddy   = new Caddy("Bones", player1, player2);

            // Need to set the course in caddy - perhaps from args.
            // Need to set the scoring method in caddy = perhaps from args.

            Console.WriteLine(caddy.ToString());

            // Simulate the game.
            caddy.Game();
        } /* end Main */
Esempio n. 6
0
        // GET: Caddies/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Caddy caddy = db.Caddy.Find(id);

            if (caddy == null)
            {
                return(HttpNotFound());
            }
            return(View(caddy));
        }
Esempio n. 7
0
        // DELETE: odata/Caddies(5)
        public IHttpActionResult Delete([FromODataUri] int key)
        {
            Caddy caddy = db.Caddy.Find(key);

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

            db.Caddy.Remove(caddy);
            db.SaveChanges();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 8
0
        // GET: Caddies/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Caddy caddy = db.Caddy.Find(id);

            if (caddy == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClientId = new SelectList(db.Client, "Id", "Name", caddy.ClientId);
            return(View(caddy));
        }
Esempio n. 9
0
        // GET: Caddies/Create
        public ActionResult Create()
        {
            Caddy caddy = new Caddy();

            caddy.xPos     = 0;
            caddy.yPos     = 0;
            caddy.zPos     = 0;
            caddy.ClientId = null;
            caddy.State    = "Free";
            Log log = new Log();

            log.Trigger = "Caddy";
            log.Message = "New Caddy added";
            log.Time    = DateTime.Now;
            log.Cide    = "4";
            db.Caddy.Add(caddy);
            db.Log.Add(log);
            db.SaveChanges();

            ViewBag.ClientId = new SelectList(db.Client, "Id", "Name");
            return(RedirectToAction("Index"));
        }
Esempio n. 10
0
        public ActionResult Create([Bind(Include = "Id,xPos,yPos,zPos,State,ClientId")] Caddy caddy)
        {
            if (ModelState.IsValid)
            {
                caddy.xPos     = 0;
                caddy.yPos     = 0;
                caddy.zPos     = 0;
                caddy.ClientId = null;
                caddy.State    = "Free";
                Log log = new Log();
                log.Trigger = "Caddy";
                log.Message = "New Caddy added";
                log.Time    = DateTime.Now;
                log.Cide    = "4";
                db.Caddy.Add(caddy);
                db.Log.Add(log);

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ClientId = new SelectList(db.Client, "Id", "Name", caddy.ClientId);
            return(View(caddy));
        }
Esempio n. 11
0
        // PUT: odata/Caddies(5)
        public IHttpActionResult Put([FromODataUri] int key, Delta <Caddy> patch)
        {
            Validate(patch.GetEntity());

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

            Caddy caddy = db.Caddy.Find(key);

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

            patch.Put(caddy);

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

            return(Updated(caddy));
        }
Esempio n. 12
0
 public void AddNew(Caddy c)
 {
     utOfWork.CaddyRepository.Add(c);
     utOfWork.Commit();
 }