Exemplo n.º 1
0
        public ActionResult Put(int id, [FromBody] EditProizvodDTO dto)
        {
            dto.Id = id;
            try
            {
                _editProizvod.Execute(dto);
                return(StatusCode(204));
            }
            catch (EntityNotFoundException e) { return(NotFound(e.Message)); }

            catch (Exception e) { return(StatusCode(500, e.Message)); }
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id, [FromForm] EditProizvodDTO dto)
        {
            dto.Id = id;
            try
            {
                // TODO: Add update logic here

                _editProizvod.Execute(dto);

                return(RedirectToAction(nameof(Index)));
            }
            catch (EntityNotFoundException e) { TempData["Error"] = e.Message; }
            catch (Exception e) { TempData["Error"] = "Server error " + e.Message; }
            return(View());
        }