Example #1
0
 public IActionResult SendMail([Bind("DateTo,DateFrom")] ReportBindingModel model)
 {
     model.UserId    = Program.User.Id;
     model.UserEmail = Program.User.Email;
     model.FileName  = @"..\UrskiyPeriodUserAPP\wwwroot\report\Report.pdf";
     APIUser.PostRequest("api/report/SendMail", model);
     return(Redirect("~/Home/Index"));
 }
Example #2
0
 public void Delete(int Id)
 {
     APIUser.PostRequest($"api/main/deleteroute", new RouteBindingModel
     {
         Id = Id
     });
     Response.Redirect("../Index");
 }
Example #3
0
 public IActionResult ReportOnView([Bind("DateTo,DateFrom")] ReportBindingModel model)
 {
     model.UserId   = Program.User.Id;
     model.FileName = @"..\UrskiyPeriodUserAPP\wwwroot\report\Report.pdf";
     APIUser.PostRequest("api/report/MakePdf", model);
     ViewBag.Report = model.FileName;
     return(View("Email"));
 }
Example #4
0
        public IActionResult ReportXls([Bind("RouteId")] ReportBindingModel model)
        {
            model.FileName = @"..\UrskiyPeriodUserAPP\wwwroot\report\Report.xls";
            APIUser.PostRequest("api/report/MakeExcel", model);

            var fileName = "Report.xls";
            var filePath = _environment.WebRootPath + @"\report\" + fileName;

            return(PhysicalFile(filePath, "application/xls", fileName));
        }
Example #5
0
 public IActionResult Index([Bind("ReserveId", "Sum")] PaymentBindingModel model, decimal reserveSum)
 {
     if (reserveSum < model.Sum)
     {
         throw new Exception("Внесённая сумма не должна быть больше, чем сумма к оплате");
     }
     model.UserId = Program.User.Id;
     APIUser.PostRequest("api/payment/Pay", model);
     return(Redirect("~/Home/Index"));
 }
Example #6
0
 public void Register(string login, string password, string email)
 {
     if (!string.IsNullOrEmpty(login) && !string.IsNullOrEmpty(password) &&
         !string.IsNullOrEmpty(email))
     {
         APIUser.PostRequest("api/user/register", new UserBindingModel
         {
             Login    = login,
             Email    = email,
             Password = password
         });
         Response.Redirect("Enter");
         return;
     }
     throw new Exception("Введите логин, пароль и электронную почту");
 }
Example #7
0
 public void Privacy(string email, string password, string login)
 {
     if (!string.IsNullOrEmpty(login) && !string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(login))
     {
         Program.User.Login    = login;
         Program.User.Email    = email;
         Program.User.Password = password;
         APIUser.PostRequest("api/User/updatedata", new UserBindingModel
         {
             Id       = Program.User.Id,
             Login    = login,
             Email    = email,
             Password = password
         });
         Response.Redirect("Index");
         return;
     }
     throw new Exception("Введите логин, пароль и ФИО");
 }
Example #8
0
        public void Create(DateTime datepicker, [Bind("ReserveId", "Name")] RouteViewModel model)
        {
            List <ReserveViewModel> reserves = model.ReserveId.
                                               Select(x => APIUser.GetRequest <ReserveViewModel>($"api/main/GetReserve?id={x}")).ToList();

            if (string.IsNullOrEmpty(model.Name) || datepicker == null || model.ReserveId.Count == 0)
            {
                return;
            }
            APIUser.PostRequest("api/main/CreateRoute", new RouteBindingModel
            {
                UserId        = Program.User.Id,
                Cost          = reserves.Sum(x => x.Price),
                Count         = reserves.Count,
                Name          = model.Name,
                DateVisit     = datepicker,
                RouteReverces = reserves.ToDictionary(x => x.Id, x => x.Name)
            });
            Response.Redirect("Index");
        }