Пример #1
0
        public IHttpActionResult PostDigitalInfoMaster(DigitalInfoMaster digitalInfoMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DigitalInfoMasters.Add(digitalInfoMaster);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (DigitalInfoMasterExists(digitalInfoMaster.id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = digitalInfoMaster.id }, digitalInfoMaster));
        }
Пример #2
0
        public IHttpActionResult PutDigitalInfoMaster(int id, DigitalInfoMaster digitalInfoMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #3
0
        public IHttpActionResult GetDigitalInfoMaster(int id)
        {
            DigitalInfoMaster digitalInfoMaster = db.DigitalInfoMasters.Find(id);

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

            return(Ok(digitalInfoMaster));
        }
Пример #4
0
        public IHttpActionResult DeleteDigitalInfoMaster(int id)
        {
            DigitalInfoMaster digitalInfoMaster = db.DigitalInfoMasters.Find(id);

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

            db.DigitalInfoMasters.Remove(digitalInfoMaster);
            db.SaveChanges();

            return(Ok(digitalInfoMaster));
        }