// GET: Evaluations/Edit/5 public async Task <ActionResult> Edit(Guid?id) { Object validatedEvaluation = await this.ValidateEvaluation(id); try { Evaluation evaluation = (Evaluation)validatedEvaluation; if (evaluation.Sections.Count() <= 0) { EvaluationViewModel evaluationViewModel = new EvaluationViewModel { Name = evaluation.Name, MinutesDuration = evaluation.MinutesDuration, QuestionIds = evaluation.Questions.Select(x => x.Id).ToList(), LimitDate = evaluation.LimitDate }; return(View(evaluationViewModel)); } else { Flash.Error("Error", "Esta evaluación no puede ser modificada porque se encuentra asignada"); return(RedirectToAction("Index")); } } catch (Exception e) { Console.WriteLine(e); return((ActionResult)validatedEvaluation); } }
public async Task <ActionResult> TakeQuiz(Guid?Id) { if (Id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Evaluation evaluation = await Db.Evaluations.Where(x => x.Id == Id).FirstOrDefaultAsync <Evaluation>(); if (evaluation == null) { return(HttpNotFound()); } EvaluationBL evaluationBL = new EvaluationBL(); if (evaluationBL.UserCanBeEvaluated(evaluation, CurrentUser.Id)) { DateTime dateTime = evaluation.EvaluationUsers.Where(x => x.UserId == CurrentUser.Id).FirstOrDefault().TakenDate; dateTime = dateTime.ToUniversalTime(); TimeZoneInfo estTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Venezuela Standard Time"); dateTime = TimeZoneInfo.ConvertTimeFromUtc(dateTime, estTimeZone); ViewBag.InitialDateTime = DateTime.UtcNow; TimeZoneInfo estTimeZone2 = TimeZoneInfo.FindSystemTimeZoneById("Venezuela Standard Time"); ViewBag.InitialDateTime = TimeZoneInfo.ConvertTimeFromUtc(ViewBag.InitialDateTime, estTimeZone2); await Db.SaveChangesAsync(); return(View("TakeQuiz", evaluationBL.GetQuiz(evaluation, dateTime))); } await Db.SaveChangesAsync(); Flash.Error("Error", "Esta evaluación ya ha sido presentada o Ha ocurrido un error al intentar presentar la evaluación"); return(RedirectToAction("Evaluations")); }
public async Task <ActionResult> Create([Bind(Exclude = "Questions")] EvaluationViewModel evaluationViewModel) { try { if (ModelState.IsValid && evaluationViewModel.QuestionIds.Count() > 0) { Evaluation evaluation = new Evaluation { MinutesDuration = evaluationViewModel.MinutesDuration, LimitDate = evaluationViewModel.LimitDate, Name = evaluationViewModel.Name, Created = DateTime.Now, Questions = Db.Questions.Where(x => evaluationViewModel.QuestionIds.ToList().Contains(x.Id)).ToList(), }; Db.Evaluations.Add(evaluation); await Db.SaveChangesAsync(); Flash.Success("Ok", "La Evaluación ha sido creada exitosamente"); return(RedirectToAction("index")); } } catch (Exception) { } Flash.Error("Error", "No se Ha Podido guardar la Evaluación"); return(View(evaluationViewModel)); }
public ActionResult UnlinkLogin_Post(string provider) { using (var context = dataContextFactory.Create()) { var model = LinkAccountModel.ForUser(context, User.Identity); if (!model.AllowRemovingLogin) { Flash.Error( "The login could not be unlinked because it is the last login available for this account."); } else { var providerAccount = OAuthWebSecurity.GetAccountsFromUserName(User.Identity.Name) .Single(a => a.Provider.ToLower() == provider.ToLower()); if (OAuthWebSecurity.DeleteAccount(providerAccount.Provider, providerAccount.ProviderUserId)) { Flash.Success("Your " + provider + " login has been unlinked"); } else { Flash.Error("The account could not be unlinked."); } } } return(RedirectToAction("LinkAccount")); }
public async Task <ActionResult> DeleteConfirmed(Guid id) { try { CaseStudy caseStudy = await Db.CaseStudies.Where(x => x.Id == id).FirstOrDefaultAsync(); if (caseStudy == null) { return(HttpNotFound()); } //Revisar que no tenga simulaciones activas List <Section> sections = await Db.Sections.Where(x => x.CaseStudyId == id).ToListAsync(); foreach (var section in sections) { section.CaseStudyId = null; if (section.IsActivedSimulation) { throw new Exception(); } } Db.CaseStudies.Remove(caseStudy); await Db.SaveChangesAsync(); Flash.Success("Ok", "El caso de estudio ha sido eliminado exitosamente"); } catch (Exception) { Flash.Error("Error", "No se puede eliminar el caso de estudio, revise el caso no se esté llevando a cabo por los estudiantes"); } return(RedirectToAction("Index")); }
public async Task <ActionResult> Create([Bind(Exclude = "DocumentPath")] DocumentViewModel documentViewModel) { try { if (ModelState.IsValid) { var uploadDir = "~/Content/app_files/"; var imagePath = Path.Combine(Server.MapPath(uploadDir), documentViewModel.Document.FileName); var imageUrl = Path.Combine(uploadDir, documentViewModel.Document.FileName); documentViewModel.Document.SaveAs(imagePath); Db.Documents.Add(new Document { Id = Guid.NewGuid(), Name = documentViewModel.Name, Path = imageUrl, } ); await Db.SaveChangesAsync(); Flash.Success("Ok", "El documento ha sido agregado satisfactoriamente"); return(RedirectToAction("Index")); } else { throw new Exception(); } } catch { Flash.Error("Error", "ha ocurrido un error cargando el archivo"); return(View()); } }
public async Task <ActionResult> AssignSection([Bind(Exclude = "EvaluationName,Semesters")] AssignEvaluationViewModel evaluationModel) { try { //Evaluación a Asignarle sección var evaluation = await Db.Evaluations.Where(x => x.Id == evaluationModel.Id).FirstOrDefaultAsync(); List <Section> sections; if (evaluationModel.Sections != null) { //Secciones por ser asignadas sections = await Db.Sections.Where(x => evaluationModel.Sections.Contains(x.Id)).ToListAsync(); } else { sections = null; } if (evaluation != null) { evaluation.Sections.Clear(); evaluation.Sections = sections; } await Db.SaveChangesAsync(); Flash.Success("Ok", "Las Asignaciones han sido exitosas"); return(RedirectToAction("Index")); } catch (Exception e) { Console.WriteLine(e); Flash.Error("Error", "La Asignación no ha sido posible"); return(View(evaluationModel)); } }
public async Task <ActionResult> DeleteConfirmed(Guid?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Document document = await Db.Documents.Where(x => x.Id == id).FirstOrDefaultAsync(); if (document == null) { return(HttpNotFound()); } if (!String.IsNullOrEmpty(document.Path)) { string fullPath = Request.MapPath(document.Path); if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } } Db.Documents.Remove(document); await Db.SaveChangesAsync(); Flash.Success("Ok", "Documento eliminado satisfactoriamente"); return(RedirectToAction("Index")); } catch { Flash.Error("Error", "Ha ocurrido un error eliminado el documento"); return(RedirectToAction("Index")); } }
public async Task <ActionResult> DisableSimulation([Bind(Prefix = "DisableId")] Guid?Id) { Section section = await Db.Sections.Where(x => x.Id == Id).FirstOrDefaultAsync <Section>(); try { if (section == null) { throw new Exception(); } section.IsActivedSimulation = false; if (section.Periods.LastOrDefault() != null) { section.Periods.LastOrDefault().IsLastPeriod = true; } await Db.SaveChangesAsync(); Flash.Success("Ok", "La Simulación ha sido finalizada"); return(RedirectToAction("Index")); } catch { Flash.Error("Error", "Ha ocurrido un error finalizando la simulación"); return(RedirectToAction("Index")); } }
public async Task <ActionResult> EnableSimulation([Bind(Prefix = "EnableId")] Guid?Id) { try { if (Id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Section section = await Db.Sections.Where(c => c.Id == Id).FirstOrDefaultAsync(); if (section == null) { return(HttpNotFound()); } if (section.IsActivedSimulation == false && section.Periods.Count() > 0) { Flash.Error("No se puede re activar una simulación"); return(RedirectToAction("Index")); } section.IsActivedSimulation = true; foreach (var group in section.Groups) { group.IsInSimulation = true; } await Db.SaveChangesAsync(); Flash.Success("Ok", "La Simulación ha sido activada con exito"); return(RedirectToAction("Index")); } catch { Flash.Error("Error", "Ha Ocurrido un error habilitando la sección"); return(RedirectToAction("Index")); } }
public async Task <ActionResult> DeleteConfirmed(Guid?id) { Question question = await Db.Questions.FindAsync(id); try { if (question.Evaluations.Count() == 0) { if (!String.IsNullOrEmpty(question.ImagePath)) { string fullPath = Request.MapPath(question.ImagePath); if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } } Db.Questions.Remove(question); await Db.SaveChangesAsync(); Flash.Success("Ok", "Pregunta eliminada satisfactoriamente"); return(RedirectToAction("Index")); } else { throw new Exception(); } } catch (Exception) { Flash.Error("Error", "Pregunta no puede ser eliminada, revise que no tenga relaciones"); return(View(question)); } }
public async Task <ActionResult> Create([Bind(Include = "Name,SectionId,SemesterId,Users")] GroupViewModel group) { if (ModelState.IsValid) { if (!(group.Users.Count() == Db.Users.Where(x => (x.SectionId == group.SectionId && x.GroupId == null) && (group.Users.Contains(x.Id))).Count())) { Flash.Error("Error", "Ha ocurrido un error creando el grupo, revise que el usuario no tenga un grupo asignado"); return(View(group)); } try { List <User> users = await Db.Users.Where(x => group.Users.Contains(x.Id)).ToListAsync(); group.Id = Guid.NewGuid(); Db.Groups.Add(new Group { Id = group.Id, Name = group.Name, Score = "0", Users = users, SectionId = group.SectionId }); await Db.SaveChangesAsync(); Flash.Success("Ok", "Grupo creado exitosamente"); ViewBag.SemesterId = group.SemesterId.ToString(); ViewBag.SectionId = group.SectionId.ToString(); ModelState.Clear(); return(View()); } catch (Exception e) { Flash.Error("Error", e.Message.ToString()); return(View(group)); } } return(View(group)); }
public async Task <ActionResult> Login(LoginViewModel model, string returnUrl) { if (!ModelState.IsValid) { Flash.Error("Error", "Ha ocurrido un error iniciando sesión"); return(View(model)); } // This doesn't count login failures towards account lockout // To enable password failures to trigger account lockout, change to shouldLockout: true var user = await UserManager.FindByEmailAsync(model.Email); var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout : false); if (user != null && !await UserManager.IsEmailConfirmedAsync(user.Id) && result == SignInStatus.Success) { return(RedirectToAction("Confirmation", "Account", new { UserId = user.Id, returnUrl = returnUrl, rememberMe = model.RememberMe })); } switch (result) { case SignInStatus.Success: return(RedirectToLocal(returnUrl)); case SignInStatus.LockedOut: return(View("Lockout")); case SignInStatus.RequiresVerification: return(RedirectToAction("SendCode", new { returnUrl = returnUrl, RememberMe = model.RememberMe })); case SignInStatus.Failure: default: Flash.Error("Error", "Intento de Inicio de sesión inválido."); return(View(model)); } }
public async Task <ActionResult> Edit([Bind(Include = "Id,Number,Name,City,Distance")] ProductViewModelEdit productViewModel) { List <Product> duplicatedProducts = Db.Products.Where(x => (x.Number == productViewModel.Number || x.Name == productViewModel.Name) && (x.Id != productViewModel.Id)).ToList(); if (duplicatedProducts.Count() > 0) { Flash.Error("Error", "El producto no puede ser editado con esos valores, se encuentran duplicados"); return(View(productViewModel)); } if (ModelState.IsValid) { Product product = await Db.Products.Where(x => x.Id == productViewModel.Id).FirstOrDefaultAsync(); product.Number = productViewModel.Number; product.Name = productViewModel.Name; product.City = productViewModel.City; product.Distance = productViewModel.Distance; if (TryUpdateModel(product)) { await Db.SaveChangesAsync(); Flash.Success("Ok", "El producto ha sido editado exitosamente"); return(RedirectToAction("Index")); } else { Flash.Error("Error", "El usuario no puede ser editado"); return(View(productViewModel)); } } return(View(productViewModel)); }
public void Can_Create_Error_Message() { var message = Flash.Error("Oh No!"); Assert.IsNotNull(message); Assert.IsTrue(message.Text == "Oh No!"); Assert.IsTrue(message.Type == "error"); }
public async Task <ActionResult> AssignSection([Bind(Exclude = "CaseStudyName, Semesters")] AssignSectionViewModel caseStudyModel) { if (ModelState.IsValid) { CaseStudy caseStudy = await Db.CaseStudies.Where(x => x.Id == caseStudyModel.Id).FirstOrDefaultAsync(); if (caseStudy == null) { Flash.Error("Error", "No existe el caso de estudio"); return(RedirectToAction("Index")); } List <Section> activatedSections = caseStudy.Sections.Where(x => x.IsActivedSimulation == true).ToList(); List <Section> finalizedSections = caseStudy.Sections.Where(x => x.IsActivedSimulation == false && x.Periods.Select(c => c.IsLastPeriod).Contains(true)).ToList(); caseStudy.Sections.Clear(); if (caseStudyModel.Sections != null) { List <Section> sections = Db.Sections.Where(x => caseStudyModel.Sections.Contains(x.Id)).ToList(); caseStudy.Sections = sections; } if (activatedSections.Count() > 0) { var displayWarning = false; foreach (var activatedSection in activatedSections) { caseStudy.Sections.Add(activatedSection); if (caseStudyModel.Sections != null) { if (!caseStudyModel.Sections.Contains(activatedSection.Id)) { displayWarning = true; } } else { displayWarning = true; } } if (displayWarning) { Flash.Warning("Advertencia", "No pueden ser desasignados los casos estudios que tengan simulaciones activas"); } } if (finalizedSections.Count() > 0) { finalizedSections.ForEach(x => x.Groups.ToList().ForEach(t => Db.Groups.Where(z => z.Id == t.Id).FirstOrDefault().IsInSimulation = false)); finalizedSections.SelectMany(x => x.Periods).ToList().ForEach(x => Db.Periods.Remove(x)); Flash.Warning("Adventencia", "Simulaciones finalizadas han sido eliminadas"); } await Db.SaveChangesAsync(); Flash.Success("Ok", "El caso de Estudio ha sido asignado a las sección(es) satisfactoriamente"); return(RedirectToAction("Index")); } ViewBag.SelectedSections = Db.Sections.Where(y => y.CaseStudyId == caseStudyModel.Id).Select(x => x.Id).ToList(); Flash.Error("Error", "Ha Ocurrido un error"); return(View(caseStudyModel)); }
public ActionResult Index() { Flash.Success("Well Done!", "You successfully read this important alert message."); Flash.Warning("Warning!", "You should really read this message"); Flash.Info("Info!", "you can read this... if you want."); Flash.Error("Error!", "The sky is falling!"); return(View()); }
public ActionResult FlashSelect() { Flash.Error("oh no!"); Flash.Warning("sucks"); Flash.Error("something terrible again"); Flash.Success("everything is fine and I live in a shell."); return(View()); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { // probably don't need to do this, but hey just be safe if (string.IsNullOrWhiteSpace(Key)) { Flash.Error(Message); } else { Flash.Unique(Key).Error(Message); } }
public async Task <ActionResult> TakeQuiz(QuizViewModel quiz) { Evaluation evaluation = await Db.Evaluations.Where(x => x.Id == quiz.Id).FirstOrDefaultAsync(); if (evaluation == null) { return(HttpNotFound()); } EvaluationBL evaluationBL = new EvaluationBL(); try { List <Answer> answers = null; if (quiz.RunoutTime) { quiz.Questions = quiz.Questions.Where(x => x.Options != null).ToList(); answers = quiz.Questions.Select(x => new Answer { QuestionOptionId = x.Options.SelectedAnswer }).ToList(); } if (ModelState.IsValid) { if (evaluationBL.UserCanBeEvaluated(evaluation, CurrentUser.Id, answers)) { evaluationBL.TakeQuiz(evaluation, quiz, CurrentUser.Id); await Db.SaveChangesAsync(); Flash.Success("Ok", "El Quiz ha sido presentado exitosamente"); QuizViewModel reviewedQuiz = evaluationBL.ReviewQuiz(evaluation, CurrentUser.Id); return(View("ReviewQuiz", reviewedQuiz)); } else { await Db.SaveChangesAsync(); Flash.Error("Error", "Ha caducado el tiempo para presentar el quiz"); return(RedirectToAction("Evaluations")); } } else { Flash.Error("Error", "Ha ocurrido un error al intentar presentar la evaluación"); return(RedirectToAction("Evaluations")); } } catch (Exception) { Flash.Error("Error", "Ha ocurrido un error al intentar presentar la evaluación"); return(RedirectToAction("Evaluations")); } }
public async Task <ActionResult> Confirmation([Bind(Include = "Id, Email, FirstName, LastName, IdCard, Password, ConfirmPassword")] ConfirmationViewModel model, string returnUrl, bool rememberMe = false) { if (ModelState.IsValid) { var user = await UserManager.FindByIdAsync(model.Id); if (user == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Bad Request")); } else if (user.EmailConfirmed) { Flash.Error("Error", "Este usuario ya ha sido confirmado"); return(RedirectToAction("Login", "Account")); } PasswordHasher passwordHash = new PasswordHasher(); passwordHash.HashPassword(model.Password); user.Email = model.Email; user.UserName = model.Email; user.FirstName = model.FirstName; user.LastName = model.LastName; user.IdCard = model.IdCard; user.PasswordHash = passwordHash.HashPassword(model.Password); user.EmailConfirmed = true; var updateResult = await UserManager.UpdateAsync(user); if (!updateResult.Succeeded) { ModelState.AddModelError("", "Intento de confirmación inválido."); AddErrors(updateResult); } else { var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, rememberMe, shouldLockout : false); if (result == SignInStatus.Success) { Flash.Success("Ok", "Usuario Confirmado exitosamente"); return(RedirectToLocal(returnUrl)); } ModelState.AddModelError("", "Intento de inicio de sesión inválido."); } } foreach (ModelState modelState in ModelState.Values) { foreach (ModelError error in modelState.Errors) { Flash.Error("Error", error.ErrorMessage); } } return(RedirectToAction("Login", "Account")); }
public async Task <ActionResult> Register([Bind(Include = "Email, FirstName, LastName, IdCard, Password, ConfirmPassword, SemesterId, SectionId, RoleName")] RegisterViewModel model) { RegisterViewModel register = new RegisterViewModel(); ViewBag.Roles = register.Roles; if (ModelState.IsValid) { if (model.SectionId == null) { Flash.Error("Error", "Ha Ocurrido un error"); return(View(model)); } var user = new User { UserName = model.Email, Email = model.Email, FirstName = model.FirstName, LastName = model.LastName, IdCard = model.IdCard, EmailConfirmed = false, }; if (model.RoleName == "Estudiante") { user.SectionId = model.SectionId; } var result = await UserManager.CreateAsync(user, "123456"); if (result.Succeeded) { UserManager.AddToRole(user.Id, model.RoleName); ViewBag.SectionId = model.SectionId.ToString(); ViewBag.SemesterId = model.SemesterId.ToString(); ModelState.Clear(); Flash.Success("Ok", "Usuario fue registrado exitosamente"); return(View()); } AddErrors(result); } foreach (ModelState modelState in ModelState.Values) { foreach (ModelError error in modelState.Errors) { Flash.Error("Error", error.ErrorMessage); } } // If we got this far, something failed, redisplay form return(View(model)); }
public async Task <ActionResult> DeleteConfirmation(string Id) { var user = await UserManager.FindByIdAsync(Id); if (user != null) { await UserManager.DeleteAsync(user); Flash.Success("OK!", "Usuario eliminado exitosamente"); return(RedirectToAction("Index")); } Flash.Error("Error", "No se ha podido eliminar el usaurio"); return(View(user)); }
public virtual ActionResult Destroy(TKey id) { try { T entity = repository.GetById(id); repository.Delete(entity); Flash.Success(content: (string)Messages.SuccessDestroy); } catch (Exception ex) { Flash.Error(content: ex.ExpandMessage()); } return(RedirectToCollectionUrl()); }
public async Task <ActionResult> Edit([Bind(Include = "Id, Description")] SemesterViewModel semester) { if (ModelState.IsValid) { Semester semesterDomain = new Semester { Id = semester.Id, Description = semester.Description }; Db.Entry(semesterDomain).State = EntityState.Modified; await Db.SaveChangesAsync(); Flash.Success("OK", "Semestre editado exitosamente"); return(RedirectToAction("Index")); } Flash.Error("Error", "El semestre no ha podido ser editado"); return(View(semester)); }
public async Task <ActionResult> Create([Bind(Include = "Description")] SemesterViewModel semesterViewModel) { if (ModelState.IsValid) { Semester semester = new Semester(); semester.Id = Guid.NewGuid(); semester.Description = semesterViewModel.Description; Db.Semesters.Add(semester); await Db.SaveChangesAsync(); Flash.Success("OK", "Semestre Creado Exitosamente"); return(RedirectToAction("Index")); } Flash.Error("Error", "Ha Ocurrido un error al agregar el semestre, revise los campos"); return(View(semesterViewModel)); }
public async Task <ActionResult> DeleteConfirmed(Guid id) { Product product = await Db.Products.FindAsync(id); try{ Db.Products.Remove(product); await Db.SaveChangesAsync(); Flash.Success("Ok", "Producto eliminado satisfactoriamente"); return(RedirectToAction("Index")); } catch (Exception) { Flash.Error("Error", "Producto no puede ser eliminado, revise que no tenga relaciones"); return(View(product)); } }
public virtual ActionResult Create(T entity) { if (ModelState.IsValid) { try { entity = repository.Insert(entity); Flash.Success(content: (string)Messages.SuccessSave); return(RedirectToDefaultUrl(entity)); } catch (Exception ex) { Flash.Error(content: ex.ExpandMessage()); } } return(View(this.RouteNames.NewName, entity)); }
public async Task <ActionResult> RegisterDemands(Guid?Id) { try { Section section = await Db.Sections.Where(x => x.Id == Id).FirstOrDefaultAsync <Section>(); if (section == null) { throw new Exception(); } if (section.IsActivedSimulation == false && section.Periods.Count() > 0) { Flash.Error("El Modelo de gestión ha finalizado"); return(RedirectToAction("Index")); } if (section.IsActivedSimulation == false) { Flash.Error("Error", "No ha sido activada la simulación"); return(RedirectToAction("Index")); } var caseStudyQuery = Db.CaseStudies.Where(x => x.Id == section.CaseStudyId); CaseStudy caseStudy = await caseStudyQuery.FirstOrDefaultAsync(); DemandViewModel sellViewModel = new DemandViewModel { ProductDemands = caseStudy.InitialCharges.Select(y => new ProductDemand { Product = y.Product }).OrderBy(t => t.Product.Number).ToList <ProductDemand>(), Section = section, SectionId = section.Id, }; return(View(sellViewModel)); } catch { Flash.Error("Error", "Ha ocurrido un error inesperado"); return(RedirectToAction("Index")); } }
public ActionResult StudentStadistics() { Section section = CurrentUser.Section; if (section.CaseStudy == null) { Flash.Error("Error", "No existe un modelo de gestión asignado para esta sección"); return(RedirectToAction("Index", "Home")); } Group group = CurrentUser.Group; if (group == null) { Flash.Error("Error", "No pertenece a ningún grupo para poder visualizar estadisticas"); return(RedirectToAction("Index", "Home")); } if (group.IsInSimulation == false) { Flash.Error("Error", "No participa en el modelo de gestión para poder visualizar estadisticas"); return(RedirectToAction("Index", "Home")); } if (section.Periods.Count() == 0) { Flash.Warning("Adventencia", "No hay datos para mostrar"); } StadisticsBL stadistics = new StadisticsBL(); ResultBL results = new ResultBL(); ViewBag.PeriodNumber = section.CaseStudy.Periods; StadisticsViewModel stadisticsViewModel = new StadisticsViewModel(); stadisticsViewModel.TotalCost = stadistics.GetTotalCost(group); stadisticsViewModel.DemandCost = stadistics.GetDemandCost(group); stadisticsViewModel.OrderCost = stadistics.GetOrderCost(group); stadisticsViewModel.StockCost = stadistics.GetStockCost(group); stadisticsViewModel.AverageTotalCost = stadistics.GetAverageTotalCost(section); stadisticsViewModel.AverageDemandCost = stadistics.GetAverageDemandCost(section); stadisticsViewModel.AverageOrderCost = stadistics.GetAverageOrderCost(section); stadisticsViewModel.AverageStockCost = stadistics.GetAverageStockCost(section); stadisticsViewModel.Groups = results.GetRanking(section); return(View(stadisticsViewModel)); }