Beispiel #1
0
        public async Task <IActionResult> Response(object result, IEnumerable <Notification> notifications)
        {
            if (!notifications.Any())
            {
                try
                {
                    bool ExistsNofications = false;

                    _uow.OpenTransaction();

                    await _uow.Commit();


                    return(Ok(new
                    {
                        success = true,
                        data = result
                    }));
                }
                catch (Exception ex)
                {
                    return(await TryErrors(ex));
                }
            }
            else
            {
                _uow.Rollback();
                return(BadRequest(new { success = false, errors = notifications.GroupBy(x => new { x.Property, x.Message }).Select(x => x.FirstOrDefault()) }));
            }
        }