public async Task <IActionResult> Update([FromBody] ShopBridgeVM shopBridgeVM)
        {
            try
            {
                var response = await _shopBridgeServices.UpdateRecord(shopBridgeVM);

                return(Ok(response));
            }
            catch
            {
                throw;
            }
        }
Esempio n. 2
0
        public async Task <string> UpdateRecord(ShopBridgeVM shopBridgeVM)
        {
            try
            {
                if (!String.IsNullOrWhiteSpace(shopBridgeVM.Id))
                {
                    var shopBridgeItemDM = new ShopBridgeDM();
                    shopBridgeItemDM.Id          = Guid.Parse(shopBridgeVM.Id);
                    shopBridgeItemDM.Name        = shopBridgeVM.Name;
                    shopBridgeItemDM.Price       = shopBridgeVM.Price;
                    shopBridgeItemDM.Description = shopBridgeVM.Description;

                    return(await _shopBridgeDataAccess.UpdateRecord(shopBridgeItemDM));
                }
                return(null);
            }
            catch
            {
                throw;
            }
        }
Esempio n. 3
0
        public async Task <string> PostRecord(ShopBridgeVM shopBridgeVM)
        {
            try
            {
                if (String.IsNullOrWhiteSpace(shopBridgeVM.Id))
                {
                    var shopBridgeItemDM = new ShopBridgeDM();
                    shopBridgeItemDM.Id          = new Guid();
                    shopBridgeItemDM.Name        = shopBridgeVM.Name;
                    shopBridgeItemDM.Price       = shopBridgeVM.Price;
                    shopBridgeItemDM.Description = shopBridgeVM.Description;

                    return(await _shopBridgeDataAccess.PostRecord(shopBridgeItemDM));
                }
                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Esempio n. 4
0
        public async Task <List <ShopBridgeVM> > GetRecords()
        {
            try
            {
                var shopBridgeVMList = new List <ShopBridgeVM>();
                var response         = await _shopBridgeDataAccess.GetRecords();

                foreach (var shopBridgeItem in response)
                {
                    var sbI = new ShopBridgeVM();
                    sbI.Id          = shopBridgeItem.Id.ToString();
                    sbI.Price       = shopBridgeItem.Price;
                    sbI.Name        = shopBridgeItem.Name;
                    sbI.Description = shopBridgeItem.Description;
                    shopBridgeVMList.Add(sbI);
                }
                return(shopBridgeVMList);
            }
            catch
            {
                throw;
            }
        }