public void AddMarkToStudentByStudentId(MarkFullServiceModel markToAdd) { this.db.Marks.Add(new Mark { ValueMark = (EnumValueMark)markToAdd.ValueMark, DateReceived = markToAdd.DateReceived, DateConfirmed = markToAdd.DateConfirmed, StudentId = markToAdd.Student.Id, SubjectId = markToAdd.Subject.Id, TeacherId = markToAdd.Teacher.Id, }); this.db.SaveChanges(); }
[RequestSizeLimit(50 * 1024 * 1024)] // PT: By default is 30MB public IActionResult AddMark(MarkFullViewModel markProfileToAdd, int id) { var markProfileServiceModelToAdd = new MarkFullServiceModel { //Title = markProfileToAdd.Title, //Comment = markProfileToAdd.Comment, //DateReceived = markProfileToAdd.DateReceived, //ValueMark = (int)markProfileToAdd.ValueMark, }; this.markService.AddMarkToStudentByStudentId(markProfileServiceModelToAdd); // PT: TEMP-DATA // PT: It is a KEY-VALUE pair that can be passes until it is used. Then it is automatically deleted! this.TempData["InfoMessage"] = "This message is coming from MarksController -> [Http Post] AddMark() Action -> MarkApproved() Action -> this.View(). It confirms that YOUR MARK WAS SUBMITTED SUCCESSFULLY!"; return(this.RedirectToAction("MarkApproved", new { id = id })); }