public IActionResult Post([FromBody] Projet projet) { using (var scope = new TransactionScope()) { projet.UserId = new Guid(User.FindFirstValue(ClaimTypes.NameIdentifier)); _projetRepository.InsertProjet(projet); scope.Complete(); } Projet p = _projetRepository.GetProjetByID(projet.Id); //Notification if (p.ChefId != null) { var notification = new Notification { Nom = "Notification", Description = $"{p.Responsable.Nom} {p.Responsable.Prenom}" + "vous a ajouté en tant que chef de projet.", DateCreation = DateTime.Now, SourceId = p.Id, UserId = (Guid)p.ChefId }; //Error _notificationRepository.InsertNotification(notification); _notificationRepository.Notification(notification.UserId, notification); } //return ProjetDTO projetDTO = _mapper.Map <ProjetDTO>(projet); return(new OkObjectResult(projet)); }
public IActionResult Get(Guid id) { var projet = _projetRepository.GetProjetByID(id); ProjetDTO projetDTO = _mapper.Map <ProjetDTO>(projet); return(new OkObjectResult(projet)); }