예제 #1
0
        public async Task <IActionResult> GetBuyerView(long buyerId)
        {
            BuyerModule invMod = new BuyerModule();

            BuyerView view = await invMod.Buyer.Query().GetViewById(buyerId);

            return(Ok(view));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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));
        }