Ejemplo n.º 1
0
        public async Task <int?> InsertNewGroupShare(GroupShare groupShare)
        {
            try {
                await _dbContext.GroupShares.AddAsync(groupShare);

                var result = await _dbContext.SaveChangesAsync();

                return(result == 0 ? -1 : groupShare.Id);
            }
            catch (DbUpdateException e) {
                await _coreLogService.InsertRoutinizeCoreLog(new RoutinizeCoreLog {
                    Location            = $"{ nameof(ContentGroupService) }.{ nameof(InsertNewGroupShare) }",
                    Caller              = $"{ new StackTrace().GetFrame(4)?.GetMethod()?.DeclaringType?.FullName }",
                    BriefInformation    = nameof(DbUpdateException),
                    DetailedInformation = $"Error while inserting entry to GroupShares.\n\n{ e.StackTrace }",
                    ParamData           = $"{ nameof(groupShare) } = { JsonConvert.SerializeObject(groupShare) }",
                    Severity            = SharedEnums.LogSeverity.High.GetEnumValue()
                });

                return(null);
            }
        }