Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ManualCode,GroupName,Photo,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] StuffGroup stuffGroup)
        {
            if (id != stuffGroup.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(stuffGroup);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StuffGroupExists(stuffGroup.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(_mapper.Map <StuffGroupViewModel>(stuffGroup)));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("ManualCode,GroupName,Photo,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] StuffGroup stuffGroup)
        {
            if (ModelState.IsValid)
            {
                _context.Add(stuffGroup);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(_mapper.Map <StuffGroupViewModel>(stuffGroup)));
        }