public async Task <ActionResult <Movie> > PostMovie(InsertCmd comando) { this._notificationContext.Clear(); if (!comando.IsValid()) { this._notificationContext.AddNotifications(comando.ValidationResult); return(CreatedAtAction("GetMovie", comando)); } Movie movie = null; comando.Aplicar(ref movie); _context.Address.Add(movie.Address); _context.Movie.Add(movie); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMovie", new { id = movie.Id }, _movieDesv.Completo(movie))); }
public Category Insert(InsertCmd command) { Category result = null; if (command.IsValid()) { command.Apply(ref result); _categoryRepository.Add(result); if (_categoryRepository.Notification.HasNotifications) { Notification.AddNotifications(_categoryRepository.Notification.Notifications); } } else { command.Undo(ref result); Notification.AddNotifications(command.Validation); } return(result); }