Пример #1
0
        public async Task <IActionResult> Update(ShortcutModel model)
        {
            var shortcut = new ShortcutModifyRequest
            {
                Description = model.Description,
                Name        = model.Name,
                Icon        = model.Icon,
                TypeId      = (int)model.TypeId,
                Url         = model.Url,
                Id          = model.Id,
                Order       = model.Order,
                UpdatedById = LoggedUserId
            };

            if (shortcut.Id <= 0)
            {
                return(RedirectToErrorPage());
            }

            var exist = await _shortcutService.FindAsync(new IdRequestFilter <int>
            {
                Id = model.Id,
                CanGetInactived = true
            });

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

            await _shortcutService.UpdateAsync(shortcut);

            return(RedirectToAction(nameof(Detail), new { id = shortcut.Id }));
        }
 public async Task <IHttpActionResult> update([FromBody] ShortcutsVM entity)
 {
     return(Ok(await shortCutService.UpdateAsync(entity)));
 }