コード例 #1
0
        public IHttpActionResult PutTimeBlockDO(int id, TimeBlockDO timeBlockDO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != timeBlockDO.TimeBlockDOID)
            {
                return(BadRequest());
            }

            db.Entry(timeBlockDO).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            TimeBlockDO timeBlockDO = db.TimeBlocks.Find(id);

            db.TimeBlocks.Remove(timeBlockDO);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "TimeBlockDOID,Begin,End")] TimeBlockDO timeBlockDO)
 {
     if (ModelState.IsValid)
     {
         db.Entry(timeBlockDO).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(timeBlockDO));
 }
コード例 #4
0
        public ActionResult Create([Bind(Include = "TimeBlockDOID,Begin,End")] TimeBlockDO timeBlockDO)
        {
            if (ModelState.IsValid)
            {
                db.TimeBlocks.Add(timeBlockDO);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(timeBlockDO));
        }
コード例 #5
0
        public IHttpActionResult GetTimeBlockDO(int id)
        {
            TimeBlockDO timeBlockDO = db.TimeBlocks.Find(id);

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

            return(Ok(timeBlockDO));
        }
コード例 #6
0
        public IHttpActionResult PostTimeBlockDO(TimeBlockDO timeBlockDO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TimeBlocks.Add(timeBlockDO);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = timeBlockDO.TimeBlockDOID }, timeBlockDO));
        }
コード例 #7
0
        // GET: TimeBlockDOes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TimeBlockDO timeBlockDO = db.TimeBlocks.Find(id);

            if (timeBlockDO == null)
            {
                return(HttpNotFound());
            }
            return(View(timeBlockDO));
        }
コード例 #8
0
        public IHttpActionResult DeleteTimeBlockDO(int id)
        {
            TimeBlockDO timeBlockDO = db.TimeBlocks.Find(id);

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

            db.TimeBlocks.Remove(timeBlockDO);
            db.SaveChanges();

            return(Ok(timeBlockDO));
        }