public IActionResult MarkComponentAsComplete(ProjectComponent component, int id) { //Ensure that the project for which the complete is being submitted belongs to the current user //OR an authorized subcontractor var currentUser = GetCurrentUserProfile(); var project = _projectRepository.GetSingleProjectById(component.ProjectId); if (currentUser.Id == project.UserProfileId || currentUser.Id == component.SubcontractorId) { component.DateComplete = DateAndTime.Now; _componentRepository.AddCompleteDateToComponent(component); return(Ok()); } return(Unauthorized()); }