Exemplo n.º 1
0
        public IHttpActionResult Change(BugModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var bug = this.data.Bugs
                      .Find(model.id);

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

            bug.Status = model.Status;
            bug.Text   = model.Text;
            this.data.SaveChanges();

            model.id = bug.Id;
            return(Ok(model));
        }
Exemplo n.º 2
0
        public IHttpActionResult Change(BugModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest();
            }

            var bug = this.data.Bugs
                .Find(model.id);

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

            bug.Status = model.Status;
            bug.Text = model.Text;
            this.data.SaveChanges();

            model.id = bug.Id;
            return Ok(model);
        }
Exemplo n.º 3
0
        public IHttpActionResult Get(BugModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var bug = new Bug()
            {
                Text    = model.Text,
                LogDate = DateTime.Now.Date,
                Status  = model.Status,
            };

            this.data.Bugs.Add(bug);
            this.data.SaveChanges();

            model.id      = bug.Id;
            model.LogDate = bug.LogDate;

            return(Ok(model));
        }
Exemplo n.º 4
0
        public IHttpActionResult Get(BugModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest();
            }

            var bug = new Bug()
            {
                Text = model.Text,
                LogDate = DateTime.Now.Date,
                Status = model.Status,
            };

            this.data.Bugs.Add(bug);
            this.data.SaveChanges();

            model.id = bug.Id;
            model.LogDate = bug.LogDate;

            return Ok(model);
        }