// // GET: /Admin/Home/ public ActionResult Index() { AdminViewModel viewModel = new AdminViewModel(); var rep = new ProductRepository(); return View(viewModel); }
public ActionResult Images(int section) { var model = new AdminViewModel { GallerySection = section }; return View(model); }
public ActionResult Images(AdminViewModel model) { if (!ValidateNewImage(model)) { return View(model); } SaveImage(model); return RedirectToAction("Images", new { section = model.GallerySection }); }
public ActionResult AdminDashboardView() { var LoggedInUser = User.Identity.GetUserId(); var CurrentUser = db.Users.Where(x => x.Id == LoggedInUser).First(); if (CurrentUser.Admin == true) { //List<Skill> SkillFromDb = db.Skills.Where(x => x.CompanyId == CurrentUser.CompanyId).ToList(); Company CompanyFromDb = db.Companies.Where(x => x.CompanyId == CurrentUser.CompanyId).First(); AdminViewModel Avm = new AdminViewModel(); Avm.Company = CompanyFromDb; //Avm.Skill = CompanyFromDb.Skill; return(View(Avm)); } else { return(View("ErrorPage")); } }
// GET: Admin public ActionResult Index() { using (QuoteEntities db = new QuoteEntities()) { var customers = (from c in db.Customers select c).ToList(); var customersVM = new List <AdminViewModel>(); foreach (var customer in customers) { var customerVM = new AdminViewModel(); customerVM.Id = customer.Id; customerVM.FirstName = customer.FirstName; customerVM.LastName = customer.LastName; customerVM.EmailAddress = customer.EmailAddress; customerVM.QuoteAmount = "$" + customer.QuoteAmount; customersVM.Add(customerVM); } return(View(customersVM)); } }
public async Task <IActionResult> Test(int Id) { var currentExam = _intellectDbContext.Exams.FirstOrDefault(x => x.Id == Id); if (currentExam.ExamDate.Date != DateTime.Now.Date || currentExam.ExamStartDateTime.TimeOfDay > DateTime.Now.TimeOfDay || currentExam.ExamEndDateTime.TimeOfDay < DateTime.Now.TimeOfDay) { ViewBag.ExamNotAllowed = true; } HttpContext.Session.SetObject(Sessions.CurrentExam, currentExam); AdminViewModel admodel = new AdminViewModel(); admodel.Equestions = GetQuestions(Id).Where(q => q.ExamId == Id).ToList(); admodel.CurrentQuestion = GetQuestions(Id).Where(q => q.ExamId == Id).FirstOrDefault(); RemainedQuestions = admodel.Equestions; PreviousId = admodel.CurrentQuestion.Id; HttpContext.Session.SetString(Sessions.CurrentExamId, Id.ToString()); return(View(admodel)); }
public async Task <IActionResult> Question(int Id, int count) { var currentExam = HttpContext.Session.GetObject <Exam>(Sessions.CurrentExam); if (currentExam.ExamDate.Date != DateTime.Now.Date || currentExam.ExamStartDateTime.TimeOfDay > DateTime.Now.TimeOfDay || currentExam.ExamEndDateTime.TimeOfDay < DateTime.Now.TimeOfDay) { return(RedirectToAction(nameof(Finish))); } int currentExamId = int.Parse(HttpContext.Session.GetString(Sessions.CurrentExamId)); AdminViewModel admodel = new AdminViewModel(); admodel.CurrentQuestion = GetQuestions(int.Parse(HttpContext.Session.GetString(Sessions.CurrentExamId))).Where(x => x.Id == Id).SingleOrDefault(); admodel.Answers = GetAnswers(int.Parse(HttpContext.Session.GetString(Sessions.CurrentExamId))).Where(y => y.QuestionId == Id).ToList(); admodel.Equestions = GetQuestions(int.Parse(HttpContext.Session.GetString(Sessions.CurrentExamId))).Where(q => q.ExamId == currentExamId).ToList(); // admodel.CurrentQuestion.Remainedtime = new TimeSpan(0, 0, 60); if (admodel.CurrentQuestion != null) { HttpContext.Session.SetString(Sessions.CurrentQuestionStartTime, DateTime.Now.ToString()); HttpContext.Session.SetString(Sessions.CurrentQuestionId, admodel.CurrentQuestion.Id.ToString()); } if (count == -1) { return(RedirectToAction(nameof(Finish))); } if (count > 1) { var question = RemainedQuestions.Single(r => r.Id == admodel.CurrentQuestion.Id); PreviousId = question.Id; RemainedQuestions.Remove(question); admodel.NextQuestion = RemainedQuestions[0]; } else { admodel.NextQuestion = RemainedQuestions[0]; } count -= 1; ViewBag.Equestions = count; return(View(admodel)); }
public HttpResponseMessage ManagePack() { adminViewModel = new AdminViewModel(); try { adminServ = new AdminService(); adminViewModel.LeadAIList = adminServ.GetLeadUICode(); } catch (Exception ex) { NameValueCollection additionalInfo = new NameValueCollection(); additionalInfo.Add("PageName", "Admin"); ExceptionManager.Publish(ex, additionalInfo); errEntity.ErrorNumber = 420; errEntity.ErrorMess = "Error in Admin - To get LeadAI for Pack Management "; adminViewModel.ErrorBE = errEntity; } return(Request.CreateResponse(HttpStatusCode.OK, adminViewModel)); }
static async Task SendRequesterEmail(AdminViewModel model, IHostingEnvironment hostingEnvironment, ILogger <SGMailService> logger) { var apiKey = Environment.GetEnvironmentVariable("SENDGRID_API_KEY"); var client = new SendGridClient(apiKey); var from = new EmailAddress("no-reply@DocSign", $"Doc Sign"); var subject = $"Request Created for: {model.lName},{model.fName}"; var to = new EmailAddress(model.notifyEmail, "Signatory"); var plainTextContent = model.message; //var htmlContent = $"<strong>{model.message}</strong>"; var htmlContent = $"" + $"<p>Document request created for:{model.lName},{model.fName}, </p>" + $"<p>View the status of the document <a href={"http://localhost:8888/app/Search/"}{model.Id} >here</a>" + $"</p>"; var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent); var response = await client.SendEmailAsync(msg); logger.LogInformation("Status Code: " + response.StatusCode.ToString()); //"Your document link is: http://localhost:8888/app/Client/?" + model.Id; }
/*---------------------SCHEDULE-----------------------*/ public ActionResult Schedule() { User currentUser = (User)Session["user"]; if (currentUser == null || currentUser.Admin == false) { return(RedirectToAction("Index", "Home")); } AdminViewModel viewModel = new AdminViewModel(); viewModel.routes = dbConnection.Routes.Where(r => r.Deleted == false).ToList <Route>(); viewModel.buses = dbConnection.Buses.Where(b => b.Deleted == false).ToList <Bus>(); viewModel.schedules = dbConnection.Schedules.Where(s => s.Deleted == false).ToList <Schedule>(); return(View(viewModel)); }
public IActionResult Post([FromBody] AdminViewModel model) { ServiceResponse <Admin> response = new ServiceResponse <Admin>(); Admin entity = service.GetByAdmin(model.KullaniciAdi, model.Parola); if (entity == null) { response.Errors.Add("Kullanici adı veya parola yanlış"); response.HasError = true; return(BadRequest(response)); } else { response.entity = entity; response.IsSuccessful = true; return(Ok(response)); } }
public IActionResult PatientInfo(int id) { if (!CheckAuthorization()) { return(AuthorizeSendBack()); } var patient = repository.GetPatientById(id); if (patient != null) { AdminViewModel aModel = FillAdminModel(); aModel.Patient = mapper.Map <Patient, PatientViewModel>(patient); return(View(aModel)); } TempData["FormError"] = "Error getting patient data"; return(RedirectToAction("Main")); }
public ActionResult Login(AdminViewModel vmInfo) { if (ModelState.IsValid) //验证通过 { Sys_UserManager bll = new Sys_UserManager(); var info = bll.Login(vmInfo.LoginUID, vmInfo.LoginPWD); if (info == null) { //登录失败 ModelState.AddModelError("error", "登录失败"); } else { this.Session["MYUSER"] = info; return(Redirect("/LayUI/Index")); } } return(View()); }
public IActionResult DeleteAppointment(AdminViewModel model, int appointmentId) { var patient = repository.GetPatientById(model.Patient.Id); if (repository.DeleteAppointment(appointmentId)) { repository.SaveAll(); } else { TempData["FormError"] = "There was an issue deleting the patient"; } AdminViewModel adModel = FillAdminModel(); adModel.Patient = mapper.Map <Patient, PatientViewModel>(patient); return(View("PatientInfo", adModel)); }
public IActionResult Admin(AdminViewModel model) { ViewBag.Title = "Admin"; /*Validation: * ModelState - Uses data annotations to validate the model */ if (ModelState.IsValid) { //Create record mailService.SendModel(model); ViewBag.UserMessage = "Document sent"; ModelState.Clear(); } return(View()); }
// GET: Admin public ActionResult AdminIndex(string year, string month, string internName) { //if (AdminAuthentication()) //{ AdminViewModel viewModel = new AdminViewModel(); viewModel.PartialTask = GetTasks(); viewModel.PartialSignin = GetSignins(); if (year != null && month != null && internName != null) { var monthNum = Convert.ToInt32(month); var yearNum = Convert.ToInt32(year); var userName = _db.Task.Where(x => x.UserName == internName); var taskResult = userName.Where(x => x.Date.Month == monthNum && x.Date.Year == yearNum).OrderBy(x => x.Date).ToList(); var userName1 = _db.Signin.Where(x => x.UserName == internName); var signinResult = userName1.Where(x => x.WorkDate.Month == monthNum && x.WorkDate.Year == yearNum).OrderBy(x => x.WorkDate).ToList(); viewModel.PartialTask = taskResult; viewModel.PartialSignin = signinResult; internUrl = internName; yearUrl = year; monthUrl = month; HttpCookie cookie = new HttpCookie("filterCookie"); cookie.Values.Add("internUrl", internName); cookie.Values.Add("yearUrl", year); cookie.Values.Add("monthUrl", month); Response.Cookies.Add(cookie); return(View(viewModel)); } return(View(viewModel)); //} //return new HttpStatusCodeResult(HttpStatusCode.BadRequest); }
public IActionResult Usuarios() { ViewData["UserN"] = HttpContext.Session.GetString("USER_NOME"); ViewData["UserE"] = HttpContext.Session.GetString("USER_EMAIL"); ViewData["UserA"] = HttpContext.Session.GetString("USER_ADMIN"); ViewData["Css"] = "Usuarios"; if (ViewData["UserA"] != null) { if (bool.Parse((string)ViewData["UserA"])) { AdminViewModel adminViewModel = new AdminViewModel(); return(View(adminViewModel)); } } return(RedirectToAction("Index", "Home")); }
public ActionResult Index(string message) { var date = DateTime.Now.Date; ViewBag.Messege = message; var user = User.Identity.GetUserId(); var doctor = db.Doctors.Single(c => c.ApplicationUserId == user); var model = new AdminViewModel { Departments = db.Department.ToList(), Doctors = db.Doctors.ToList(), Patients = db.Patients.ToList(), ActiveAppointments = db.Appointments.Where(c => c.DoctorId == doctor.Id).Where(c => c.Status).Where(c => c.AppointmentDate >= date).ToList(), PendingAppointments = db.Appointments.Where(c => c.DoctorId == doctor.Id).Where(c => c.Status == false).Where(c => c.AppointmentDate >= date).ToList(), Announcements = db.Announcements.Where(c => c.AnnouncementFor == "Doctor").ToList() }; return(View(model)); }
public async Task <IActionResult> Create(AdminViewModel model) { if (ModelState.IsValid) { try { var userInput = _mapper.Map <AdminViewModel, Repository.Data.Entities.Admin>(model); await _adminService.Register(userInput); }catch (InvalidInputException e) { ModelState.AddModelError("Email", e.Message); } } if (ModelState.IsValid) { return(RedirectToAction("index")); } return(View(model)); }
public async Task <IActionResult> Index() { List <SiteUser> users = new List <SiteUser>(); foreach (SiteUser user in userManager.Users) { user.RoleNames = await userManager.GetRolesAsync(user); users.Add(user); } AdminViewModel model = new AdminViewModel { Users = users, // List of AppUsers Roles = roleManager.Roles }; return(View(model)); }
// GET //URL: AdminHome/AdminIndex public ActionResult AdminIndex(Guid?adminID) { //System.Diagnostics.Debug.WriteLine(adminID); AdminBL adminBL = new AdminBL(); Admin admin = new Admin(); AdminViewModel adminViewModel = new AdminViewModel(); admin = adminBL.GetAdminByAdminIDBL(Guid.Parse(HttpContext.Session.GetString("adminID"))); /*adminViewModel.AdminID = Guid.Parse(Convert.ToString(Session["adminID"]));*/ adminViewModel.AdminName = admin.AdminName; adminViewModel.Email = admin.Email; /*adminViewModel.LastModifiedDate = admin.LastModifiedDateTime; */ TempData["adminID"] = adminViewModel.AdminID; return(View(adminViewModel)); }
public IActionResult Index() { Korisnik k = HttpContext.GetLogiraniKorisnik(); if (k == null || k.TipKorisnikaId != 4) { ViewData["error_poruka"] = "Nemate pravo pristupa."; return(View("../Home/Index")); } AdminViewModel viewModel = new AdminViewModel { KorisnickoIme = k.LoginPodaci.KorisnickoIme, tipKorisnika = "Administrator" }; PostaviViewBag(k.Id, "Index"); return(View(viewModel)); }
public ActionResult Admin() { AdminViewModel viewModel = new AdminViewModel(); viewModel.Users = db.Users.AsEnumerable(); viewModel.MessageHtmlContent = db.GetParameterValueByCode(ParameterType.RegMessageContent); //registered users viewModel.RegisteredUsersChartViewModel = new MorrisLineChartViewModel { HeaderTitle = "Registered Users", Dates = db.Users.Where(u => u.CreationDate.HasValue).AsEnumerable().Select(u => u.CreationDateLocal.Value).AsEnumerable(), Interval = DateInterval.Monthly, Label = "Users", HtmlElementId = "registered-users" }; return(View(viewModel)); }
public async Task <IActionResult> Client(string id) { AdminViewModel model = await DocumentDBRepository <AdminViewModel> .GetItemAsync(id); ViewBag.DocName = model.DocName; ViewBag.Id = model.Id; if (!model.isSigned) { ViewBag.Title = model.fName + " " + model.lName + " you are required to sign: " + model.DocName; ViewBag.pdfURL = GetBlobSasUri(model.DocGuid); return(View()); } else { ViewBag.Title = "Welcome back " + model.fName + ", you have signed " + model.DocName; ViewBag.pdfURL = GetBlobSasUri(model.SignedDocGuid); return(View("DrawSignature")); } }
static async Task SendSignatoryEmail(AdminViewModel model, IHostingEnvironment hostingEnvironment, ILogger <SGMailService> logger) { var apiKey = Environment.GetEnvironmentVariable("SENDGRID_API_KEY"); var client = new SendGridClient(apiKey); var from = new EmailAddress(model.notifyEmail, $"{model.notifyEmail}"); var subject = $"Please Sign: {model.DocName}"; var to = new EmailAddress(model.signatoryEmail, "Signatory"); var plainTextContent = model.message; //var htmlContent = $"<strong>{model.message}</strong>"; var htmlContent = $"" + $"<p>Hello {model.fName}, </p>" + $"<p>You are required to sign <a href={"http://localhost:8888/app/Client/"}{model.Id} >{model.DocName}</a>" + $"</p><p>{model.message}</p>"; var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent); var response = await client.SendEmailAsync(msg); logger.LogInformation("Status Code: " + response.StatusCode.ToString()); //"Your document link is: http://localhost:8888/app/Client/?" + model.Id; }
public ActionResult TumSarkilar() { try { if (Session.Count == 0) { return(RedirectToAction("Logout")); } AdminViewModel model = new AdminViewModel(); model.Kategoris = context.Kategoris; model.Musics = context.Musics; model.Sanatcis = context.Sanatcis; return(View(model)); } catch (Exception) { return(RedirectToAction("/Home/Error/")); } }
public IActionResult getTable(string param) { AppUser user = _userManager.Users.SingleOrDefault(x => x.UserName == HttpContext.User.Identity.Name); var appo = param is null? _context.Appointments.ToList() : _context.Appointments.Where(ap => ap.Plaka.Contains(param) || ap.Name.Contains(param)).ToList(); foreach (var item in appo) { var appoUser = item.User; } AdminViewModel model = new AdminViewModel() { User = user, Appointment = appo, }; return(View("getTable", model)); }
public IActionResult FlaggedComments() { var comments = new List <Comment>(); for (int i = 0; i < 30; i++) { comments.Add(new Comment() { Post = "Robot0", PostedBy = $"JohnDoe{i}@gmail.com", Summary = "Some racist comment" }); } var viewModel = new AdminViewModel() { Comments = comments }; return(View(viewModel)); }
public async Task <IActionResult> Login(AdminViewModel adminViewModel, string returnUrl) { if (ModelState.IsValid) { IdentityUser admin = await _userManger.FindByNameAsync(adminViewModel.AdminName); if (admin != null) { await _signInManager.SignOutAsync(); if ((await _signInManager.PasswordSignInAsync(admin, adminViewModel.AdminPassword, false, false)).Succeeded) { return(Redirect("/Admin/IndustryFilter")); } } } ModelState.AddModelError("", "Invalid username or password"); return(View(adminViewModel)); }
public HttpResponseMessage GetRequestTypeContactDetails() { adminViewModel = new AdminViewModel(); try { adminServ = new AdminService(); adminViewModel.RequestTypeContactDetails = adminServ.GetRequestTypeContactDetails(); } catch (Exception ex) { NameValueCollection additionalInfo = new NameValueCollection(); additionalInfo.Add("PageName", "Admin"); ExceptionManager.Publish(ex, additionalInfo); errEntity.ErrorNumber = 420; errEntity.ErrorMess = "Error in Admin - To get request type contact details"; adminViewModel.ErrorBE = errEntity; } return(Request.CreateResponse(HttpStatusCode.OK, adminViewModel)); }
private void PopulateVmLists(AdminViewModel vm) { vm.Categories = new List <SelectListItem>(); foreach (var category in _categoryRepository.Categories) { vm.Categories.Add(new SelectListItem() { Text = category.CategoryName }); } vm.Pies = new List <SelectListItem>(); foreach (var pie in _pieRepository.Pies) { vm.Pies.Add(new SelectListItem() { Text = pie.Name, Value = pie.PieId.ToString() }); } }
public ActionResult Login(AdminViewModel model, string ReturnUrl) { ViewBag.ReturnUrl = ReturnUrl; if (ModelState.IsValid) { if (UserHelper.IsValidUser(model.Username, model.Password)) { if (HttpContext.User.Identity.IsAuthenticated) { FormsAuthentication.SignOut(); } FormsAuthentication.SetAuthCookie(model.Username, true); return(Redirect(ReturnUrl)); } ModelState.AddModelError("", "Wrong information, Employee please contact to Administrator when forgot infomation!"); } return(View(model)); }
public ActionResult Index(string message) { var date = DateTime.Now.Date; ViewBag.Messege = message; var model = new AdminViewModel { Departments = db.Department.ToList(), Doctors = db.Doctors.ToList(), Patients = db.Patients.ToList(), Announcements = db.Announcements.ToList(), ActiveAppointments = db.Appointments.Where(c => c.Status).Where(c => c.AppointmentDate >= date).ToList(), PendingAppointments = db.Appointments.Where(c => c.Status == false) .Where(c => c.AppointmentDate >= date).ToList() }; return(View(model)); }
public async Task<ActionResult> NewAdmin(AdminViewModel model) { if (ModelState.IsValid) { Admin admin = new Admin() { FirstName = model.FirstName, LastName = model.LastName, Email = model.Email, UserName = model.Email, CreatedBy = User.Identity.GetUserId(), CreatedDateUtc = DateTime.UtcNow, LastUpdatedBy = User.Identity.GetUserId(), LastUpdatedDateUtc = DateTime.UtcNow }; var result = await UserManager.CreateAsync(admin, "Admin123 (This should be a very long password which is hard to guess)"); if(result.Succeeded) { UserManager.AddToRole(admin.Id, "Administrator"); string token = await UserManager.GeneratePasswordResetTokenAsync(admin.Id); var callbackUrl = Url.Action("ResetPassword", "Account", new { code = token }, protocol: Request.Url.Scheme); await UserManager.SendEmailAsync(admin.Id, "New Account", "New Blank-Project account has been created for you. please visit following link to reset your password. <br /> <a href=\"" + callbackUrl + "\">here</a>"); TempData["Message"] = new Message() { Type = MessageType.Success, Title = "Success", Text = "User created sucessfully" }; return RedirectToAction("Index", "Admin", new { area = "AdminArea" }); } AddErrors(result); } return View(model); }
// // GET: /Admin/ /// <summary> /// 判断管理员身份 加载不同资料 /// </summary> /// <param name="type">检索的类型 0表示全部,1表示仅图片,2表示仅仅资料,3表示仅男生资料,4表示仅女生资料,5男生图片,6女生图片</param> /// <returns></returns> public ActionResult Index(int? type) { var indextype = 0; if (type != null) { ViewData["type"] = type; indextype = (int)type; } else { if (ViewData["type"] != null) indextype = Convert.ToInt32(ViewData["type"]); else { ViewData["type"] = 0; } } var id = CheckValid(); var role = LoveDb.One(n => n.UserId == id && (n.RoleType == RoleType.SysAdmin.ToString() || n.RoleType == RoleType.Admin.ToString())); if (role != null)//是管理员就可以 { ViewBag.ImgCount = CheckedImgCount(); ViewBag.InfoCount = Checkinfocout(); var data = new AdminViewModel { Admin = GetAdmin(role), UncheckedUsers = GetUncheckUsers(indextype) }; return View(data); } return RedirectToAction("SorryView"); }
public ActionResult _AdminList() { AdminViewModel adminModel = new AdminViewModel(); adminModel.listModel = _adminService.GetAdmin().Select(x => new ItemAdminViewModel { ID = x.ID, User_Login = x.Login }).ToList(); adminModel.allUser = _userService.GetUser().Select(x => x.Login).ToArray(); return View(adminModel); }
private bool ValidateNewImage(AdminViewModel model) { bool valid = true; if (Request.Files.Count == 0) { ModelState.AddModelError("", "Select a file"); valid = false; } if (string.IsNullOrEmpty(model.Info)) { ModelState.AddModelError("", "Enter info"); valid = false; } if (string.IsNullOrEmpty(model.Title)) { ModelState.AddModelError("", "Enter a title"); valid = false; } if (_db.GalleryImages.SingleOrDefault(i => i.Title == model.Title) != null) { ModelState.AddModelError("", "Image with this title exists"); } return valid; }
private void SaveImage(AdminViewModel model) { string fileName = Request.Files[0].FileName; var type = (GallerySectionsType)model.GallerySection; string path = ""; if (type == GallerySectionsType.Paintings) { path = "~/Content/GalleryImages/Paintings/"; } else if (type == GallerySectionsType.Photography) { path = "~/Content/GalleryImages/Photography/"; } else if (type == GallerySectionsType.Printmaking) { path = "~/Content/GalleryImages/Printmaking/"; } else if (type == GallerySectionsType.Installations) { path = "~/Content/GalleryImages/Installations/"; } Directory.CreateDirectory(HttpContext.Server.MapPath("~/Content/GalleryImages")); // save main file Request.Files[0].SaveAs(HttpContext.Server.MapPath(path) + fileName); // save thumnail var mainImage = Image.FromFile(Server.MapPath(path + fileName)); double fraction = 50.0 / (double)mainImage.Width; int height = (int)(mainImage.Height * fraction); Image thumb = mainImage.GetThumbnailImage(50, height, new Image.GetThumbnailImageAbort(() => true), IntPtr.Zero); string thumbPath = path + "/Thumbs/" + fileName; thumb.Save(Server.MapPath(thumbPath)); // add to db _db.GalleryImages.Add(new GalleryImage { Filename = path + fileName, Thumbnail = path + "/Thumbs/" + fileName, GallerySection = (int)model.GallerySection, Width = mainImage.Width, Height = mainImage.Height, Info = model.Info, Title = model.Title, Order = _db.GalleryImages.Where(i => i.GallerySection == model.GallerySection).Count() + 1 }); _db.SaveChanges(); }
public ActionResult AddAdmin(AdminViewModel adminModel) { List<string> errors; if (Session["val"] != null) { errors = ((string[])Session["val"]).ToList(); } else { errors = new List<string>(); } AdminDto _adminDto = new AdminDto(); _adminDto.Login = adminModel.viewModel.User_Login; if (_adminService.Add(_adminDto)) { errors.Add("Dodano administratora."); } else { errors.Add("Błąd. Spróbuj ponownie."); } Session["val"] = errors.ToArray<string>(); return RedirectToAction("Admin"); }