public int AddAssignment(NewAssignmentVm assignment) { var assignmentVm = _mapper.Map <Assignment>(assignment); var id = _assignmentRepository.AddAssignment(assignmentVm); return(id); }
public IActionResult CreateHomework(int courseId, Assignment assignment) { IList <Stream> streams = new List <Stream>(); var course = _classesRepository.Classes.FirstOrDefault(d => d.Id == courseId); if (course == null) { return(View("~/Views/Home/Index.cshtml")); } var AssignmentModel = new AssignmentViewModel() { assignment = assignment, course = course }; AssignmentModel.assignment.course = course; _assignmentRepository.AddAssignment(AssignmentModel.assignment); foreach (Stream stream in _appDbContext.StreamMessages) { streams.Add(stream); } var ClassStreamVM = new ClassStreamViewModel { Class = course, streams = streams }; return(View("~/Views/Class/Class.cshtml", ClassStreamVM)); }
public async Task <IActionResult> Post([FromForm] AssignmentDtoForAdd assignment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //if (await _repo.AssignmentExists(assignment.AssignmentName)) // return BadRequest(new { message = "Assignment Already Exist" }); _response = await _repo.AddAssignment(assignment); return(Ok(_response)); }
public void AddAssignment(AssignmentViewModel assignment) { Assignment assign = new Assignment() { FileName = assignment.FileName, Description = assignment.Description, Path = assignment.Path, Signature = assignment.Signature, Owner = assignment.Owner, TaskId = assignment.TaskId }; _assignmentRepo.AddAssignment(assign); }