Пример #1
0
        public IHttpActionResult PostNagrade(Nagrade obj)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            dm.Nagrade.Add(obj);
            dm.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = obj.NagradaID }, obj));
        }
Пример #2
0
        public IzmijeniNagradu(int nagradaid)
        {
            InitializeComponent();

            HttpResponseMessage response = nagradeService.GetResponse(nagradaid.ToString());

            if (response.StatusCode == System.Net.HttpStatusCode.NotFound)
            {
                n = null;
            }
            else if (response.IsSuccessStatusCode)
            {
                n = response.Content.ReadAsAsync <Nagrade>().Result;
            }
        }
Пример #3
0
        public IHttpActionResult PutNagrade(int id, Nagrade n)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            dm.esp_Nagrade_Update(id, n.Naziv, n.Od, n.Do);

            dm.SaveChanges();
            return(StatusCode(HttpStatusCode.NoContent));
        }