Пример #1
0
 public async Task<int> Post(College3GTestView view)
 {
     var college = _collegeRepository.GetByName(view.CollegeName);
     if (college == null) return 0;
     view.TestTime = DateTime.Today.AddHours(DateTime.Now.Hour);
     var result =
         _repository.FirstOrDefault(
             x => x.TestTime == view.TestTime && x.CollegeId == college.Id && x.Place == view.Place);
     if (result != null)
         Mapper.Map(view, result);
     else
         result = view.MapTo<College3GTestResults>();
     result.CollegeId = college.Id;
     await _repository.InsertOrUpdateAsync(result);
     return _repository.SaveChanges();
 }
Пример #2
0
 public async Task<int> Post(College3GTestView view)
 {
     return await _service.Post(view);
 }