public override async Task AddAsync(object request) { if (!(request is StudentExamRequest)) { throw new Exception("Convert type not allowed"); } StudentExamRequest rq = (StudentExamRequest)request; var std = rq.ProjectTo(_mapper); await _repository.AddOrUpdateAsync(std); }
public override async Task UpdateAsync(object request) { if (!(request is StudentExamRequest)) { throw new Exception("Convert type not allowed"); } StudentExamRequest req = (StudentExamRequest)request; StudentExam entity = await _repository.GetByIdAsync(req.Id); if (entity == null) { throw new Exception("Student exam not found"); } req.ProjectTo(entity); await _repository.AddOrUpdateAsync(entity); }