public string CreateReport(CreateReportDto report, User user) { var dbReport = new Report { Name = report.Name, ReportGUID = CreateGUID.GetGUID(), Query = _reportRepository.GetQuery(report.QueryGUID), Columns = StringArraySerializer(report.Columns), Filter = report.Filter, Sort = JsonConvert.SerializeObject(report.Sort, Formatting.None), Rows = report.Rows, Author = user }; _reportRepository.Add(dbReport); _userReportRel.Add(new ReportUserRel { Report = dbReport, User = user, AuthoryLayer = (int)ReportUserPermissions.CanModify }); return(dbReport.ReportGUID); }
public bool Create(CreateReportUserDto reportUserRel) { IsExistUserAndReport(out User user, out Report report, reportUserRel.UserGUID, reportUserRel.ReportGUID); if (IsExistRel(user.Id, report.Id) != null) { throw new BasicException("Already exists value with this paramterers."); } _reportUserRelRepository.Add(new ReportUserRel { Report = report, User = user, AuthoryLayer = reportUserRel.Permission }); return(true); }