public ActionResult SetMark(string StudentId, string CourseId, string Grade) { int courseId = Convert.ToInt32(CourseId); int studentId = Convert.ToInt32(StudentId); Mark mark = new Mark { Grade = Convert.ToInt32(Grade), CourseId = courseId, StudentId = studentId }; MarkRepository rep = new MarkRepository(); Mark delMark = rep.Find(m => m.CourseId == courseId && m.StudentId == studentId).FirstOrDefault(); repository.Marks.Delete(delMark.Id); repository.Marks.Create(mark); //storage.DelMark(courseId, studentId); //storage.AddMark(mark); WriteToInfo("== User: "******" action SetMark, ManageController"); return(RedirectToAction("Teacher")); }
public List <ArticleListViewModel> CreateArticleList(List <ArticleModel> articleModels) { List <ArticleListViewModel> articlesLists = new List <ArticleListViewModel>(); if (articleModels != null) { foreach (ArticleModel article in articleModels) { articlesLists.Add(new ArticleListViewModel() { Name = article.Name, Description = article.Description, Specialty = article.Specialty, Id = article.Id, LastModifeDate = article.LastModifeDate, Rate = GetAverageRate(_markRepository.Find(x => x.ArticleId == article.Id)) }); } } return(articlesLists); }