public async Task <IActionResult> Register(RegisterParticipant request) { var participant = await _mediator.Send(request); participant.AuthToken = _encryptor.EncryptData(participant.Id); return(Ok(participant)); }
public ActionResult AddParticipant(RegisterParticipant model, HttpPostedFileBase image1) { if (ModelState.IsValid && image1 != null && image1.ContentLength > 0) { Participants per = new Participants(); byte[] bytes; using (BinaryReader br = new BinaryReader(image1.InputStream)) { bytes = br.ReadBytes(image1.ContentLength); } per.Name = model.Name; per.NickName = model.NickName; per.PESEL = model.PESEL; per.Picture = bytes; _unitOfWork.Participants.Add(per); _unitOfWork.Save(); return(RedirectToAction("Participants")); } return(View("RegisterParticipant", model)); }