Example #1
0
        public async Task <IActionResult> DeleteConfirmed(CjenovnikItem cj)
        {
            _context.CjenovnikItem.Remove(cj);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Example #2
0
        public async Task <IActionResult> Create(CjenovnikItem cjItem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cjItem);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cjItem));
        }
Example #3
0
        // GET: Cjenovnik/Create
        public IActionResult Create()
        {
            CjenovnikItem cjItem = new CjenovnikItem();

            cjItem.CjenovnikId = Cjenovnik.DajCjenovnik().Id;
            if (cjItem.CjenovnikId < 1)
            {
                cjItem.CjenovnikId = 1;
            }
            return(View());
        }
Example #4
0
        // GET: Cjenovnik/Delete/5
        public async Task <IActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            CjenovnikItem cj = new CjenovnikItem();

            cj = await _context.CjenovnikItem.FirstAsync(x => x.Id == id);

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

            return(View(cj));
        }
Example #5
0
 public async Task <IActionResult> Edit(CjenovnikItem cjenovnikItem)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(cjenovnikItem);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!CjenovnikExists(cjenovnikItem.Id))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(cjenovnikItem));
 }