public virtual async Task <NotificationResult> InsertAsync(InsertIngredientCommand command) { BeginTransaction(); var result = await _handler.InsertAsync(command); return(Commit(result)); }
public virtual async Task <NotificationResult> InsertAsync(InsertIngredientCommand command) { var result = new NotificationResult(); var item = new IngredientInfo(command); result.Add(item.GetNotificationResult()); if (!result.IsValid) { return(result); } result.Add(await _ingredientRepository.InsertAsync(item)); if (result.IsValid) { result.Data = item.Id; result.AddMessage(Shared.Domain.Resources.Handler.InsertSuccess_Message); } else { result.AddErrorOnTop(Shared.Domain.Resources.Handler.InsertError_Message); } return(result); }
public IngredientInfo(InsertIngredientCommand command) { Map(command); InitCollections(); this.InsertOrUpdateScopeValidate(); }
public async Task <IActionResult> Post([FromBody] InsertIngredientCommand command) { var result = await _service.InsertAsync(command); return(Ok(result)); }