public async Task <IHttpActionResult> CrudNotificationType(CrudNotificationTypeInput input)
        {
            switch (input.Action)
            {
            case "insert":
                var result = await _notificationTypeService.AddAsync(input.Value).ConfigureAwait(false);

                return(Ok(result));

            case "update":
                await _notificationTypeService.UpdateAsync(input.Value).ConfigureAwait(false);

                return(Ok(input.Value));

            case "remove":
                await _notificationTypeService.DeleteAsync(Guid.Parse(input.Key)).ConfigureAwait(false);

                return(Ok(new
                {
                    input.Key
                }));

            default:
                return(BadRequest());
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> DeleteAsync(int notificationtypeId)
        {
            var result = await _notificationTypeService.DeleteAsync(notificationtypeId);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }
            var notificationTypeResource = _mapper.Map <NotificationType, NotificationTypeResource>(result.Resource);

            return(Ok(notificationTypeResource));
        }