public async Task <ResultDto <Guid, PatientCreateStatus> > Create(ProblemCreateRequest request, string externalId) { try { var model = _mapper.Map <ProblemCreateRequest, Problems>(request); try { model.RecordedDate = DateTime.UtcNow; model.ExternalId = externalId; var result = await _repository.Create(model); return(result); } catch (DbUpdateConcurrencyException) { return(new ResultDto <Guid, PatientCreateStatus>(PatientCreateStatus.InternalServerError)); } catch (Exception ex) { return(new ResultDto <Guid, PatientCreateStatus>(PatientCreateStatus.InternalServerError)); } } catch (Exception ex) { return(new ResultDto <Guid, PatientCreateStatus>(PatientCreateStatus.InternalServerError)); } }
public IActionResult Add([FromForm] ProblemViewModel problem) { if (ModelState.IsValid) { var problemNew = new Problem { ProblemId = Guid.NewGuid(), ProblemName = problem.ProblemName, ProblemContent = problem.ProblemContent, Dificulty = problem.Dificulty, Visible = problem.Visible, MemoryLimit = problem.MemoryLimit, TimeLimit = problem.TimeLimit }; //create problem directory via api (linux hosted) _problemRepository.Create(problemNew); _problemRepository.Save(); return(RedirectToAction("Index")); } return(View()); }
public void Create(ProblemData data) { var problem = ToStorageEntity(data); _problemRepository.Create(problem); }
public ActionResult Create(Problem problem) { repo.Create(problem); return(RedirectToAction("Index")); }