예제 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,ActionGroupId,Name,Input_Boolean_EntityId,Input_Boolean_SetState,Service_Domain,Service_Name,Service_Fields")] Data.Models.Action action)
        {
            if (id != action.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(action);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ActionExists(action.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(action));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,ActionGroupId,Name,Input_Boolean_EntityId,Input_Boolean_SetState,Service_Domain,Service_Name,Service_Fields")] Data.Models.Action action)
        {
            if (ModelState.IsValid)
            {
                _context.Add(action);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(action));
        }
예제 #3
0
        public bool CreateAction(ActionCreate model)
        {
            var entity = new Data.Models.Action()
            {
                AuthorID    = userId,
                Description = model.Description,
                LarderId    = model.LarderID
            };

            using (var context = new CookbookContext())
            {
                context.Actions.Add(entity);
                return(context.SaveChanges() == 1);
            }
        }