static void CreateGood() { var resultWithComponentsInfo = searchBilling.GetComponents().Result; List <Component> componentsInfo; if (resultWithComponentsInfo.IsSuccess) { componentsInfo = resultWithComponentsInfo.Value; } else { console.PrintErrorMessage(resultWithComponentsInfo.Message); return; } CreateGood good = console.ReadGood(componentsInfo); var resultWithCreatedOrder = editBilling.CreateGood(good).Result; if (resultWithCreatedOrder.IsSuccess) { console.PrintInfoMessage(resultWithCreatedOrder.Message); } else { console.PrintErrorMessage(resultWithCreatedOrder.Message); } }
public static CreateGoodDto ToDto(CreateGood good) => new CreateGoodDto { UnitPrice = good.UnitPrice, QuantityType = good.QuantityType, Description = string.IsNullOrEmpty(good.Description) ? null : good.Description, Components = good.Components.Select(c => ComponentConverter.ToDto(c)).ToList() };
public async Task <Result <Good> > CreateGood(CreateGood good) { var resultFromClient = await goodsClient.CreateGoodAsync(GoodConverter.ToDto(good)); return(new Result <Good> { IsSuccess = resultFromClient.IsSuccess, Message = resultFromClient.Message, Value = resultFromClient.IsSuccess ? GoodConverter.FromDto(resultFromClient.Value) : null }); }
public ActionResult Create([Bind(Prefix = "Item")] CreateGood model) { IMessageProvider msg = null; if (ModelState.IsValid) { this.ModelState.Clear(); msg = model.Create(); model = _unityContainer.Resolve <CreateGood>(); } model.Ready(); return(View(new EcardModelItem <CreateGood>(model, msg))); }