public ActionResult CreateByEmployee(int employeeid, string uppdrag, string roll, string tid, string beskrivning, string teknik, string focus) { Assigment assignment = new Assigment(employeeid, uppdrag, roll, tid, beskrivning, teknik, check(focus)); AssignmentService.Add(assignment); return(RedirectToAction("Cv", "Home", new { id = employeeid })); }
public IActionResult Index(AssignmentViewModel model) { var classroom = classroomServices.getById(model.Classroom.Id.ToString()); if (model.Type == "course") { string type = model.Type; assignmentService.Add(classroom, default(DateTime), type, model.Link, model.Description); } else if (model.Type == "assignment") { string type = model.Type; assignmentService.Add(classroom, model.DueTo, type, model.Link, model.Description); } else { string type = "announcment"; assignmentService.Add(classroom, default(DateTime), type, null, model.Description); } return(RedirectToAction("Index")); }
public async Task <IActionResult> Submit(int assignmentId, StudentAssignmentDto assignmentDto) { #region Checks AssignmentWithConcrete assignment = await _assignmentService.GetAssignmentById(assignmentId, _userService.UserId); if (assignment == null) { return(NotFound()); } if (assignment.StudentAssignment != null) { return(Conflict()); } Group group = await _groupService.GetByIdAsync(assignmentDto.GroupId); if (group == null) { return(NotFound()); } if (!_groupService.StudentExists(_userService.UserId, group.Id)) { return(Forbid()); } #endregion StudentAssignment studentAssignment = _assignmentService.Add(assignmentDto, _userService.CurrentUser, assignmentId); studentAssignment.GroupId = group.Id; await _db.SaveChangesAsync(); //await _teacherHub.NewAssignment(assignmentId, studentAssignment.Id, assignment.Assignment.TeacherId); return(CreatedAtAction(nameof(GetById), new { studentAssignment.Id }, _mapper.Map <StudentAssignmentDto>(assignment.StudentAssignment))); }