public BloodTypeDTO CreateSetup(BloodTypeDTO _Setup) { var db = new StoreContext(); BloodType Setup = mapper.Map <BloodType>(_Setup); db.Add(Setup); db.SaveChanges(); return(mapper.Map <BloodTypeDTO>(Setup)); }
public IActionResult CreatePatient([FromBody] BloodTypeDTO info) { BloodTypeDTO response = repository.CreateSetup(info); if (response != null) { return(new ObjectResult(response)); } else { return(new BadRequestObjectResult("ERROR 500")); } }
public async Task RegisterAsync(string pesel, string name, BloodTypeDTO bloodTypeDTO, string mail, string phone, string passowrd) { var donor = await donorRepository.GetAsync(pesel); if (donor != null) { throw new UserAlreadyExistsException("User with that PESEL already exists"); } var salt = encrypter.GetSalt(passowrd); var hash = encrypter.GetHash(passowrd, salt); var bloodType = await bloodTypeRepository.GetAsync(bloodTypeDTO.AboType, bloodTypeDTO.RhType); donor = new Donor(pesel, hash, salt, name, bloodType, mail, phone); await donorRepository.AddAsync(donor); }
public async Task AddAsync(BloodTypeDTO bloodTypeDto) { var bloodType = new BloodType(bloodTypeDto.AboType, bloodTypeDto.RhType); await bloodTypeRepository.AddAsync(bloodType); }