public JsonResult Invite(string email, int[] smartReportid, string comment, string ranges, string reportName, bool sendMeACopy)
        {
            var shareReports = new List <SharedReportDto>();
            var currentUrl   = Request.RawUrl;

            foreach (var id in smartReportid)
            {
                var token = Guid.NewGuid().ToString();
                shareReports.Add(new SharedReportDto()
                {
                    Comments      = "comment",
                    CreatedBy     = WebSecurity.CurrentUserId,
                    CreatedDate   = DateTime.Now,
                    ExpiredDate   = DateTime.Now.AddDays(365.0),
                    IsActive      = true,
                    Token         = token,
                    SmartReportId = id,
                    URL           = currentUrl,
                    TinyUrl       = TinyURL.GetTinyUrl(Request.Url.GetLeftPart(UriPartial.Authority) + Url.Content("~") + "Share/Redirect?token=" + token)
                });
            }
            var urlToValidateUser = Request.Url.GetLeftPart(UriPartial.Authority) + Url.Content("~");

            return(Json(_userService.InviteUser(email, shareReports, urlToValidateUser, comment, ranges, reportName, sendMeACopy), JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public JsonResult GetSharedreport(string comments, int smartReportid, string url)
        {
            var currentUrl      = Request.RawUrl;
            var token           = Guid.NewGuid().ToString();
            var sharedReportDto = new SharedReportDto()
            {
                Comments      = comments,
                CreatedBy     = WebSecurity.CurrentUserId,
                CreatedDate   = DateTime.Now,
                ExpiredDate   = DateTime.Now.AddDays(365.0),
                IsActive      = true,
                Token         = token,
                SmartReportId = smartReportid,
                URL           = url,
                TinyUrl       = TinyURL.GetTinyUrl(Request.Url.GetLeftPart(UriPartial.Authority) + Url.Content("~") + "Share/Redirect?token=" + token)
            };

            return(Json(_sharedReportService.AddSharedReport(sharedReportDto), JsonRequestBehavior.AllowGet));
        }