Exemplo n.º 1
0
        public async Task <IActionResult> Create(ShortcutModel model)
        {
            var shortcut = new ShortcutModifyRequest
            {
                Description = model.Description,
                Name        = model.Name,
                Icon        = model.Icon,
                TypeId      = (int)model.TypeId,
                Url         = model.Url,
                Order       = model.Order,
                UpdatedById = LoggedUserId,
                CreatedById = LoggedUserId
            };
            var exist = await _shortcutService.FindByNameAsync(model.Name);

            if (exist != null)
            {
                return(RedirectToErrorPage());
            }

            var id = await _shortcutService.CreateAsync(shortcut);

            return(RedirectToAction(nameof(Detail), new { id }));
        }