public async Task <IActionResult> GetBuyerView(long buyerId) { BuyerModule invMod = new BuyerModule(); BuyerView view = await invMod.Buyer.Query().GetViewById(buyerId); return(Ok(view)); }
public async Task <IActionResult> DeleteBuyer([FromBody] BuyerView view) { BuyerModule invMod = new BuyerModule(); Buyer buyer = await invMod.Buyer.Query().MapToEntity(view); invMod.Buyer.DeleteBuyer(buyer).Apply(); return(Ok(view)); }
public async Task <IActionResult> UpdateBuyer([FromBody] BuyerView view) { BuyerModule invMod = new BuyerModule(); Buyer buyer = await invMod.Buyer.Query().MapToEntity(view); invMod.Buyer.UpdateBuyer(buyer).Apply(); BuyerView retView = await invMod.Buyer.Query().GetViewById(buyer.BuyerId); return(Ok(retView)); }
public async Task <IActionResult> AddBuyer([FromBody] BuyerView view) { BuyerModule invMod = new BuyerModule(); NextNumber nnBuyer = await invMod.Buyer.Query().GetNextNumber(); view.BuyerNumber = nnBuyer.NextNumberValue; Buyer buyer = await invMod.Buyer.Query().MapToEntity(view); invMod.Buyer.AddBuyer(buyer).Apply(); BuyerView newView = await invMod.Buyer.Query().GetViewByNumber(view.BuyerNumber); return(Ok(newView)); }