Beispiel #1
0
        public async Task <ActionResult <BuyerPersonalInfoViewModel> > GetBuyerPersonalInfo(int id)
        {
            try
            {
                if (id > 0)
                {
                    BuyerPersonalInfo buyerPersonalInfo = await _bContext.BuyerPersonalInfos.FindAsync(id);

                    if (buyerPersonalInfo != null)
                    {
                        return(Ok(new { status = 200, obj = assignDataBuyerViewModel(buyerPersonalInfo), message = id + " : The Buyer data retrive successfully." }));
                    }
                    else
                    {
                        return(BadRequest(new { status = 404, message = id + " is not found" }));
                    }
                }
                else
                {
                    return(BadRequest(new { status = 404, message = message }));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #2
0
        public BuyerPersonalInfoViewModel assignDataBuyerViewModel(BuyerPersonalInfo model)
        {
            BuyerPersonalInfoViewModel buyerPersonalInfoViewModel = new BuyerPersonalInfoViewModel
            {
                Id                = model.Id,
                BuyerNo           = model.BuyerNo,
                Name              = model.Name,
                Organization      = model.Organization,
                OrganizationTaxId = model.OrganizationTaxId,
                Position          = model.Position,
                CreatedDate       = model.CreatedDate,
                IsOwner           = model.IsOwner,
                UpdatedDate       = model.UpdatedDate
            };

            return(buyerPersonalInfoViewModel);
        }