Example #1
0
        public async Task DeleteLocation(LocationCreateModel data)
        {
            try
            {
                switch (data.companyType)
                {
                case "MSP":
                    await Task.Run(() => ManageMSP.DeleteMSPLocationBranch(data.id, "Location"));

                    break;

                case "Customer":
                    await Task.Run(() => ManageCustomer.DeleteCustomerLocationBranch(data.id, "Location"));

                    break;

                case "Supplier":
                    await Task.Run(() => ManageSupplier.DeleteSupplierBranchLocation(data.id, "Location"));

                    break;
                }

                await Task.Run(() => ManageLocation.DeleteLocation(data.id));
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        public async Task <LocationCreateModel> CreateLocation(LocationCreateModel data)
        {
            try
            {
                LocationCreateModel model        = null;
                tblLocation         dataLocation = await Task.Run(() => ManageLocation.InsertLocation(data.ConvertTotblLocation()));

                model           = (await Task.Run(() => ManageLocation.GetLocationDetails(dataLocation.ID))).ConvertToLocation();
                data.locationId = model.id;

                switch (data.companyType)
                {
                case "MSP":
                    tblMSPLocationBranch dataMSP = await Task.Run(() => ManageMSP.InsertMSPLocationBranch(data.ConvertTotblMSPLocationBranch()));

                    break;

                case "Customer":
                    tblCustomerLocationBranch dataCustomer = await Task.Run(() => ManageCustomer.InsertCustomerLocationBranch(data.ConvertTotblCustomerLocationBranch()));

                    break;

                case "Supplier":
                    tblSupplierLocationBranch dataSupplier = await Task.Run(() => ManageSupplier.InsertSupplierLocationBranch(data.ConvertTotblSupplierLocationBranch()));

                    break;
                }

                return(model);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #3
0
        public async Task <LocationCreateModel> UpdateLocation(LocationCreateModel model)
        {
            try
            {
                tblLocation data = await Task.Run(() => ManageLocation.UpdateLocation(model.ConvertTotblLocation()));

                return(data.ConvertToLocation());
            }
            catch (Exception)
            {
                throw;
            }
        }