/// <summary> /// Initializes a new instance of the <see cref="FlashMessage"/> class. /// </summary> /// <param name="severity">The message severity.</param> /// <param name="title">The message title.</param> /// <param name="message">The message text.</param> /// <param name="options">The message options.</param> public FlashMessage(Toastr severity, string title, string message, object options) { Severity = severity; Title = title; Message = message; Options = options != null ? JsonSerializer.Serialize(options) : string.Empty; }
public ActionResult Edit(int id, SchemaModel model) { MemoryStream stream = null; var fileName = string.Empty; // Check whether file needs to be updated if (model.UploadFile != null) { // Setup file stream stream = new MemoryStream(); fileName = model.UploadFile.FileName; model.UploadFile.InputStream.CopyTo(stream); } // Setup internal model var data = new DataLinker.Models.SchemaModel { DataSchemaID = id, Description = model.Description, IsAggregate = model.IsAggregate, IsIndustryGood = model.IsIndustryGood, Name = model.Name, PublicId = model.PublicId }; // Update schema _dataSchemaService.Update(data, stream, fileName, LoggedInUser); // Setup status message Toastr.Success("Schema was successfully updated"); // Return result return(RedirectToAction("Index")); }
public async Task <ActionResult> Login(Core.ViewModels.Login model) { if (!ModelState.IsValid) { return(View(model)); } var user = await _userManager.FindAsync(model.Email, model.Password); if (user == null) { ModelState.AddModelError("", "Invalid username or password."); model.Password = string.Empty; return(View(model)); } await _signInManager.SignInAsync(user, isPersistent : true, rememberBrowser : false); TempData["Toastr"] = new Toastr { Type = "success", Title = "Success", Message = "Successfully logged in." }; return(RedirectToAction("Index", "Home")); }
public override void Execute() { WriteLiteral("\r\n"); #line 6 "..\..\Views\Shared\_Toastr.cshtml" if (TempData.ContainsKey("Toastr")) { Toastr toastr = TempData["Toastr"] as Toastr; #line default #line hidden #line 9 "..\..\Views\Shared\_Toastr.cshtml" Write(ToastrBuilder.ShowToastMessages(toastr)); #line default #line hidden #line 9 "..\..\Views\Shared\_Toastr.cshtml" ; } #line default #line hidden }
public IActionResult CreateProduct(ProductModel model) { if (!ModelState.IsValid) { return(View(model)); } var entity = new Product() { Name = model.Name, ImageUrl = model.ImageUrl == null ? "urun-resim-yok.png" : model.ImageUrl, Description = model.Description, Price = model.Price }; if (_productService.Create(entity)) { ToastrService.AddToUserQueue(new Toastr() { Message = Toastr.GetMessage("Ürün"), Title = Toastr.GetTitle("Ürün"), ToastrType = ToastrType.Success }); return(View(new ProductModel())); } ViewBag.ErrorMessage = _productService.ErrorMessage; return(View(model)); }
// GET: PaymentMethods/Details/5 public ActionResult Details(int?id) { try { if (id == null) { TempData["Toastr"] = Toastr.BadRequest; return(RedirectToAction("Index")); } var paymentMethod = _db.PaymentMethods.Find(id); if (paymentMethod != null) { return(View(paymentMethod)); } TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } catch (Exception ex) { TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } }
public ActionResult Create([Bind(Include = "Id,MethodName")] PaymentMethod paymentMethod) { using (var dbTransaction = _db.Database.BeginTransaction()) { try { ModelState.Clear(); paymentMethod.MethodId = string.Format("PI-{0:000000}", _db.PaymentMethods.Count() + 1); paymentMethod.EntryBy = _db.Users.First(x => x.UserName == User.Identity.Name).Id; paymentMethod.EntryDate = DateTime.Now; TryValidateModel(paymentMethod); if (ModelState.IsValid) { _db.PaymentMethods.Add(paymentMethod); _db.SaveChanges(); dbTransaction.Commit(); TempData["Toastr"] = Toastr.Added; return(RedirectToAction("Index")); } dbTransaction.Rollback(); return(View(paymentMethod)); } catch (Exception ex) { dbTransaction.Rollback(); TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } } }
protected void AddToCart_Click(object sender, EventArgs e) { // Pizza list List <Pizza> list; int pizzaid = int.Parse(MenuGrid.Rows[((GridViewRow)((Control)sender).NamingContainer).RowIndex].Cells[0].Text); string name = MenuGrid.Rows[((GridViewRow)((Control)sender).NamingContainer).RowIndex].Cells[1].Text; string toppings = MenuGrid.Rows[((GridViewRow)((Control)sender).NamingContainer).RowIndex].Cells[2].Text; float price = float.Parse(MenuGrid.Rows[((GridViewRow)((Control)sender).NamingContainer).RowIndex].Cells[3].Text); if (Session["cart"] == null) { list = new List <Pizza>(); list.Add(new Pizza(pizzaid, name, toppings, price)); Session["cart"] = list; Toastr.Success(this.Page, $"{name} added to cart!", "SUCCESS"); } else { list = (List <Pizza>)Session["cart"]; list.Add(new Pizza(pizzaid, name, toppings, price)); Session["cart"] = list; Toastr.Success(this.Page, $"{name} added to cart!", "SUCCESS"); } }
public ActionResult CreateDbBackUp() { try { var connectionString = WebConfigurationManager.ConnectionStrings["CrmDbContext"].ConnectionString; var builder = new SqlConnectionStringBuilder(connectionString); var databaseName = builder.InitialCatalog; var backUpDirectory = Server.MapPath("~/Backup/"); var fileName = "CRM_" + DateTime.Now.ToString("yyyy-MM-dd HH.mm.ss") + ".bak"; var backupPath = Path.Combine(backUpDirectory, fileName); if (!Directory.Exists(backUpDirectory)) { Directory.CreateDirectory(backUpDirectory); } foreach (var file in Directory.GetFiles(backUpDirectory, "*.bak").Where(item => item.EndsWith(".bak"))) { System.IO.File.Delete(file); } var query = string.Format("BACKUP DATABASE [{0}] TO DISK ='{1}'", databaseName, backupPath); _db.Database.ExecuteSqlCommand(TransactionalBehavior.DoNotEnsureTransaction, query); var fileBytes = System.IO.File.ReadAllBytes(backupPath); return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName)); } catch (Exception ex) { TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } }
public ActionResult DeleteConfirmed(int?countryId) { using (var dbTransaction = _db.Database.BeginTransaction()) { try { if (countryId == null) { TempData["Toastr"] = Toastr.BadRequest; return(RedirectToAction("Index")); } if (!_db.Countries.Any(x => x.Id == countryId)) { TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } _db.Countries .Where(x => x.Id == countryId) .Update(u => new Country { DelStatus = true }); dbTransaction.Commit(); TempData["Toastr"] = Toastr.Deleted; return(RedirectToAction("Index")); } catch (Exception ex) { dbTransaction.Rollback(); TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } } }
public ActionResult Create([Bind(Include = "CountryName,CountryCode,DelStatus")] Country country) { using (var dbTransaction = _db.Database.BeginTransaction()) { try { ModelState.Clear(); country.EntryBy = _db.Users.First(x => x.UserName == User.Identity.Name).Id; country.EntryDate = DateTime.Now; TryValidateModel(country); if (ModelState.IsValid) { _db.Countries.Add(country); _db.SaveChanges(); dbTransaction.Commit(); TempData["Toastr"] = Toastr.Added; return(RedirectToAction("Index")); } dbTransaction.Rollback(); return(View(country)); } catch (Exception ex) { dbTransaction.Rollback(); TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } finally { ViewBag.Status = Common.ToSelectList <Status>(); } } }
public static void ShowToastr(Page page, string message, string title, Toastr type) { string toastrType; switch (type) { case Toastr.Warning: toastrType = "warning"; break; case Toastr.Success: toastrType = "success"; break; case Toastr.Error: toastrType = "error"; break; case Toastr.Info: toastrType = "info"; break; default: toastrType = ""; break; } page.ClientScript.RegisterStartupScript( page.GetType(), "toastr_message", String.Format("toastr.{0}('{1}', '{2}');", toastrType, message, title), addScriptTags: true); }
public ActionResult Create(string appType, Models.Applications.NewApplicationDetails model) { // Setup url for notification var url = Url.Action("Index", "Applications", null, Request.Url.Scheme); // Setup name var data = (NewApplicationDetails)model; data.Name = model.Name; // Create application Application application = _applications.Create(url, model, LoggedInUser); // Log details for industry good application if (application.IsIntroducedAsIndustryGood) { // Log industry good action _auditLog.Log(AuditStream.General, "Industry Good", new { id = LoggedInUser.ID, email = LoggedInUser.Email }, new { remote_ip = Request.UserHostAddress, browser = Request.Browser.Browser }); } // Setup status message Toastr.Success("Service was successfully created"); return(RedirectToAction("Details", new { id = application.ID })); }
public ActionResult Edit(int id, Models.Applications.ApplicationDetails appDetails) { var urlToApps = Url.Action("Index", "Applications", null, Request.Url.Scheme); // Setup name var model = (ApplicationDetails)appDetails; model.Name = appDetails.Name; // edit application Application application = _applications.EditApplication(id, urlToApps, model, LoggedInUser); // Log industry good action if (application.IsIntroducedAsIndustryGood && appDetails.IsIntroducedAsIndustryGood && !application.IsVerifiedAsIndustryGood) { _auditLog.Log(AuditStream.UserActivity, "Industry Good", new { id = LoggedInUser.ID, email = LoggedInUser.Email }, new { remote_ip = Request.UserHostAddress, browser = Request.Browser.Browser }); } // Setup status Toastr.Success("Application was successfully updated."); // Return result return(RedirectToAction("Details", new { id = application.ID })); }
public async Task <ActionResult> Register(Core.ViewModels.Register model) { if (!ModelState.IsValid) { return(View(model)); } var user = new ApplicationUser() { UserName = model.Email, Email = model.Email, FirstName = model.FirstName, LastName = model.LastName }; var result = await _userManager.CreateAsync(user, model.Password); if (!result.Succeeded) { AddModelErrors(result); return(View()); } string code = await _userManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = Url.RouteUrl("ActivateAccount", new { userId = user.Id, code }, protocol: Request.Url.Scheme); await _userManager.SendEmailAsync(user.Id, "Activate your account", "Please activate your account by clicking here: " + callbackUrl + ""); TempData["Toastr"] = new Toastr { Type = "success", Title = "Success", Message = "Your account has been created. You have to activate your account before you could log in." }; return(RedirectToAction("Index", "Home")); }
public ActionResult Create(SchemaModel model) { // Check whether file present if (model.UploadFile == null) { Toastr.Error("You should upload a schema"); return(View(model)); } // Setup stream var stream = new MemoryStream(); model.UploadFile.InputStream.CopyTo(stream); // Setup model var newSchema = new DataLinker.Models.SchemaModel { Description = model.Description, PublicId = model.PublicId, IsAggregate = model.IsAggregate, IsIndustryGood = model.IsIndustryGood, Name = model.Name, Status = TemplateStatus.Draft, Version = 1 }; // Create new schema _dataSchemaService.Create(newSchema, stream.ToArray(), model.UploadFile.FileName, LoggedInUser); // Setup status message Toastr.Success("Schema was successfully created"); // Return result return(RedirectToAction("Index")); }
// GET: Groups/Edit/5 public ActionResult Edit(int?id) { try { if (id == null) { TempData["Toastr"] = Toastr.BadRequest; return(RedirectToAction("Index")); } var group = _db.Groups.Find(id); ViewBag.IsGroupIsAdmin = _db.Groups.Any(x => x.Id == id && x.Name.ToLower() == "admin"); if (group != null) { return(View(group)); } TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } catch (Exception ex) { TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } }
public ActionResult DeleteConfirmed(int?id) { using (var dbTransaction = _db.Database.BeginTransaction()) { try { if (id == null) { TempData["Toastr"] = Toastr.BadRequest; return(RedirectToAction("Index")); } var clientInfo = _db.ClientInfos.Find(id); if (clientInfo == null) { TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } _db.ClientInfos.Remove(clientInfo); _db.SaveChanges(); dbTransaction.Commit(); TempData["Toastr"] = Toastr.Deleted; return(RedirectToAction("Index")); } catch (Exception ex) { dbTransaction.Rollback(); TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } } }
public ActionResult Create(Group group) { using (var dbTransaction = _db.Database.BeginTransaction()) { try { if (!ModelState.IsValid) { return(View(group)); } if (_db.Groups.Any(x => x.Name == group.Name)) { ModelState.AddModelError("Name", @"Group Name already exist, try another."); return(View(group)); } _db.Groups.Add(group); _db.SaveChanges(); dbTransaction.Commit(); TempData["Toastr"] = Toastr.Added; return(RedirectToAction("Index")); } catch (Exception ex) { dbTransaction.Rollback(); TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } } }
public async Task <IActionResult> CreateBanner(IFormFile file) { if (file != null) { var entity = new BannerImage() { ImageUrl = file.FileName }; var path = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\img\banner", file.FileName); using (var stream = new FileStream(path, FileMode.Create)) await file.CopyToAsync(stream); if (_bannerImageService.Create(entity)) { ToastrService.AddToUserQueue(new Toastr() { Message = Toastr.GetMessage("Banner Resmi"), Title = Toastr.GetTitle("Banner"), ToastrType = ToastrType.Success }); return(RedirectToAction("BannerList")); } } ViewBag.ErrorMessage = _bannerImageService.ErrorMessage; return(RedirectToAction("BannerList")); }
public ActionResult Edit(int?id) { try { if (id == null) { TempData["Toastr"] = Toastr.BadRequest; return(RedirectToAction("Index")); } var client = _db.ClientInfos.Find(id); if (client == null) { TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } ViewBag.StatusList = Common.ToSelectList <Status>(); ViewBag.BranchList = new SelectList(_db.BranchInfos, "Id", "BranchName", client.BranchId); ViewBag.ReferralTypes = Common.ToSelectList <ReferralsType>(client.ReferralType); ViewBag.IsRequireSupplier = Common.ToSelectList <RequireSuppiler>(client.SupplierId == null ? (int)RequireSuppiler.No : (int)RequireSuppiler.Yes); ViewBag.ServiceList = new SelectList(_db.ServiceInfos.OrderBy(x => x.ServiceName), "Id", "ServiceName", client.ServiceId); ViewBag.WorkingStatusList = Common.ToSelectList <WorkingStatus>(client.WorkingStatus); ViewBag.SmsConfirmationList = Common.ToSelectList <SmsConfirmation>(client.SmsConfirmation); ViewBag.InfoStatusList = Common.ToSelectList <InformationUpdate>(client.InfoStatus); ViewBag.DeliveryStatusList = Common.ToSelectList <DeliveryStatus>(client.DeliveryStatus); ViewBag.StatusList = Common.ToSelectList <Status>(client.Status); return(View(client)); } catch (Exception ex) { TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } }
public ActionResult Create(Menu menu) { using (var dbTransaction = _db.Database.BeginTransaction()) { try { if (!ModelState.IsValid) { dbTransaction.Dispose(); ViewBag.Modules = Common.ToSelectList <Module>(); ViewBag.StatusList = Common.ToSelectList <Status>(); return(View(menu)); } _db.Menus.Add(menu); _db.SaveChanges(); dbTransaction.Commit(); TempData["Toastr"] = Toastr.Added; return(RedirectToAction("Index")); } catch (Exception ex) { dbTransaction.Rollback(); TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } } }
// GET: Navigation/Edit/5 public ActionResult Edit(int?id) { try { if (id == null) { TempData["Toastr"] = Toastr.BadRequest; return(RedirectToAction("Index")); } var menu = _db.Menus.Find(id); if (menu == null) { TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } ViewBag.Modules = Common.ToSelectList <Module>(menu.ModuleName); ViewBag.StatusList = Common.ToSelectList <Status>(menu.Status); return(View(menu)); } catch (Exception ex) { TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } }
public async Task <ActionResult> ConfirmUser(UserConfirmModel model) { try { // Save user credentials User user = await _users.SaveUserCredentials(model.Token, model.Password); // Audit log _auditLog.Log(AuditStream.UserSecurity, "Registration Completed", new { userId = user.ID }, new { remote_ip = Request.UserHostAddress, browser = Request.Browser.Browser }); } catch (EmailExpiredException) { return(View("EmailLinkExpired", new Models.ErrorModel { Message = ConfigurationManager.AppSettings["DataLinkerContactEmail"] })); } Toastr.Success("Email verification process was successfully completed."); return(View("EmailConfirmed", new Models.ErrorModel())); }
public async Task <IActionResult> CreateService(ServiceModel model, IFormFile file) { if (!ModelState.IsValid) { return(View(model)); } var entity = new Service(); if (file != null) { entity.ImageUrl = file.FileName; var path = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\img\about\service", file.FileName); using (var stream = new FileStream(path, FileMode.Create)) await file.CopyToAsync(stream); } entity.Title = model.Title; entity.Description = model.Description; if (_aboutServicesService.Create(entity)) { ToastrService.AddToUserQueue(new Toastr() { Message = Toastr.GetMessage("Servis"), Title = Toastr.GetTitle("Servis"), ToastrType = ToastrType.Success }); return(View(new ServiceModel())); } ViewBag.ErrorMessage = _aboutServicesService.ErrorMessage; return(View(model)); }
// GET: Services/Edit/5 public ActionResult Edit(int?id) { try { if (id == null) { TempData["Toastr"] = Toastr.BadRequest; return(RedirectToAction("Index")); } var service = _db.ServiceInfos.Find(id); if (service == null) { TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } ViewBag.StatusList = Common.ToSelectList <Status>(service.Status); return(View(service)); } catch (Exception ex) { TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } }
// GET: Employees/Details/5 public ActionResult Details(int?id) { try { if (id == null) { TempData["Toastr"] = Toastr.BadRequest; return(RedirectToAction("Index")); } var employee = _db.EmployeeBasicInfos.Find(id); if (employee == null) { TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } var imageToShow = !string.IsNullOrWhiteSpace(employee.ImageUrl) ? employee.ImageUrl : "/Content/template/img/avatars/default.png"; ViewBag.Designations = new SelectList(_db.EmployeeDesignations, "Id", "DesignationTitleEn", employee.EmployeeDesignationId); ViewBag.BloodGroups = Common.ToSelectList <BloodGroup>(employee.BloodGroup); ViewBag.Levels = Common.ToSelectList <EmployeeLevel>(employee.UserLevel); ViewBag.Image = System.IO.File.Exists(Server.MapPath("~" + imageToShow)) ? imageToShow : ""; return(View(employee)); } catch (Exception ex) { TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } }
public ActionResult Create([Bind(Include = "Id,SupplierName,SupplierEmail,SupplierPhone,SupplierAddress,SupplierMobileNo")] SuppliersInfo supplier) { using (var dbTransaction = _db.Database.BeginTransaction()) { try { ModelState.Clear(); supplier.SupplierId = string.Format("SI-{0:000000}", _db.SuppliersInfos.Count() + 1); supplier.EntryBy = _db.Users.First(x => x.UserName == User.Identity.Name).Id; supplier.EntryDate = DateTime.Now; TryValidateModel(supplier); if (ModelState.IsValid) { _db.SuppliersInfos.Add(supplier); _db.SaveChanges(); dbTransaction.Commit(); TempData["Toastr"] = Toastr.Added; return(RedirectToAction("Index")); } dbTransaction.Rollback(); return(View(supplier)); } catch (Exception ex) { dbTransaction.Rollback(); TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } } }
// GET: Suppliers/Details/5 public ActionResult Details(int?id) { try { if (id == null) { TempData["Toastr"] = Toastr.BadRequest; return(RedirectToAction("Index")); } var suppliersInfo = _db.SuppliersInfos.Find(id); if (suppliersInfo != null) { return(View(suppliersInfo)); } TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } catch (Exception ex) { TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } }
/// <summary> /// Initializes a new instance of the <see cref="FlashMessage"/> class. /// </summary> /// <param name="severity">The message severity.</param> /// <param name="title">The message title.</param> /// <param name="message">The message text.</param> /// <param name="options">The message options.</param> public FlashMessage(Toastr severity, string title, string message, object options) { Severity = severity; Title = title; Message = message; Options = options != null?JsonSerializer.Serialize(options) : string.Empty; }
public ActionResult Edit([Bind(Include = "Id,SupplierName,SupplierEmail,SupplierPhone,SupplierAddress,SupplierMobileNo")] SuppliersInfo supplier, int?id) { using (var dbTransaction = _db.Database.BeginTransaction()) { try { if (id == null) { TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } if (_db.SuppliersInfos.Count(x => x.Id == id) < 1) { TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } var suppliersInfo = _db.SuppliersInfos.Single(x => x.Id == id); if (suppliersInfo == null) { TempData["Toastr"] = Toastr.HttpNotFound; return(RedirectToAction("Index")); } ModelState.Clear(); supplier.SupplierId = suppliersInfo.SupplierId; supplier.EntryBy = suppliersInfo.EntryBy; supplier.EntryDate = suppliersInfo.EntryDate; supplier.DelStatus = suppliersInfo.DelStatus; TryValidateModel(supplier); if (!ModelState.IsValid) { return(View(supplier)); } _db.SuppliersInfos .Where(x => x.Id == id) .Update(u => new SuppliersInfo { SupplierName = supplier.SupplierName, SupplierEmail = supplier.SupplierEmail, SupplierPhone = supplier.SupplierPhone, SupplierAddress = supplier.SupplierAddress, SupplierMobileNo = supplier.SupplierMobileNo }); dbTransaction.Commit(); TempData["Toastr"] = Toastr.Updated; return(RedirectToAction("Index")); } catch (Exception ex) { dbTransaction.Rollback(); TempData["Toastr"] = Toastr.DbError(ex.Message); return(RedirectToAction("Index")); } } }
/// <summary> /// Returns the correct toastr function name based on the message severity. /// </summary> /// <param name="severity">Message severity.</param> /// <returns>Toastr function name.</returns> private static object GetToastrFunctionCall(Toastr severity) { switch (severity) { case Toastr.SUCCESS: return "success"; case Toastr.INFO: return "info"; case Toastr.WARNING: return "warning"; case Toastr.ERROR: return "error"; default: throw new ArgumentException("Unknown severity value", "severity"); } }
/// <summary> /// Adds a Toastr notification of the specified severity to be displayed on page load. /// </summary> /// <param name="controller">The controller to extend.</param> /// <param name="severity">The message severity.</param> /// <param name="message">The message text.</param> public static void Flash(this Controller controller, Toastr severity, string message) { var messages = new MessageManager(controller.TempData); messages.Add(new FlashMessage(severity, message)); }
/// <summary> /// Adds a Toastr notification of the specified severity to be displayed on page load. /// </summary> /// <param name="controller">The controller to extend.</param> /// <param name="severity">The message severity.</param> /// <param name="title">The message title.</param> /// <param name="message">The message text.</param> /// <param name="options">The message options.</param> public static void Flash(this Controller controller, Toastr severity, string title, string message, object options) { var messages = new MessageManager(controller.TempData); messages.Add(new FlashMessage(severity, title, message, options)); }
/// <summary> /// Initializes a new instance of the <see cref="FlashMessage"/> class. /// </summary> /// <param name="severity">The message severity.</param> /// <param name="message">The message text.</param> public FlashMessage(Toastr severity, string message) : this(severity, null, message, null) { }