private static ServiceRequest CreateServiceRequestInDatabase(int creatingUserId, int priorityId)
 {
     using (EducationDataContext context = new EducationDataContext())
     {
         ServiceRequestFulfillment newServiceRequestFulfillment = new ServiceRequestFulfillment { FulfillmentStatusId = 1, Notes = "Test", CreatingUserId = 1 };
         ServiceRequest newRequestToEdit = new ServiceRequest { CreatingUserId = creatingUserId, PriorityId = priorityId, ServiceTypeId = 1, StudentId = 6, SubjectId = 2, FulfillmentDetails = new List<ServiceRequestFulfillment> { newServiceRequestFulfillment } };
         context.ServiceRequests.Add(newRequestToEdit);
         context.SaveChanges();
         return newRequestToEdit;
     }
 }
        public void WhenConstruct_ThenCreateTimeSet()
        {
            ServiceRequestFulfillment actual = new ServiceRequestFulfillment();

            Assert.IsTrue(actual.CreateTime.WithinTimeSpanOf(TimeSpan.FromMilliseconds(20), DateTime.Now));
        }
 public void Update(ServiceRequestFulfillment item)
 {
     Context.SetModified(item);
 }
 public void Remove(ServiceRequestFulfillment item)
 {
     Context.ServiceRequestFulfillments.Remove(item);
 }
 public void Add(ServiceRequestFulfillment item)
 {
     Context.ServiceRequestFulfillments.Add(item);
 }
        public void WhenConstruct_ThenCreateTimeSet()
        {
            ServiceRequestFulfillment actual = new ServiceRequestFulfillment();

            Assert.IsTrue(actual.CreateTime.WithinTimeSpanOf(TimeSpan.FromMilliseconds(20), DateTime.Now));
        }
 private void CreateFulfillmentDetail(ServiceRequest model, EducationSecurityPrincipal user, ServiceRequestModel viewModel)
 {
     int selectedStatusId = viewModel.SelectedStatusId != 0 ? viewModel.SelectedStatusId : 1;
     var newDetail = new ServiceRequestFulfillment
     {
         FulfilledById = viewModel.SelectedAssignedOfferingId,
         CreatingUser = user.Identity.User,
         ServiceRequest = model,
         FulfillmentStatusId = selectedStatusId,
         Notes = viewModel.FulfillmentNotes
     };
     if (model.FulfillmentDetails == null)
     {
         model.FulfillmentDetails = new List<ServiceRequestFulfillment> { newDetail };
     }
     else
     {
         model.FulfillmentDetails.Add(newDetail);
     }
 }