Exemplo n.º 1
0
        public IHttpActionResult PostPorjectLangauge(PorjectLangauge porjectLangauge)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PorjectLangauges.Add(porjectLangauge);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (PorjectLangaugeExists(porjectLangauge.ProjectID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = porjectLangauge.ProjectID }, porjectLangauge));
        }
Exemplo n.º 2
0
        public IHttpActionResult PutPorjectLangauge(Guid id, PorjectLangauge porjectLangauge)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 3
0
        public IHttpActionResult GetPorjectLangauge(Guid id)
        {
            PorjectLangauge porjectLangauge = db.PorjectLangauges.Find(id);

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

            return(Ok(porjectLangauge));
        }
Exemplo n.º 4
0
        public IHttpActionResult DeletePorjectLangauge(Guid id)
        {
            PorjectLangauge porjectLangauge = db.PorjectLangauges.Find(id);

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

            db.PorjectLangauges.Remove(porjectLangauge);
            db.SaveChanges();

            return(Ok(porjectLangauge));
        }