public async Task <BranchCreateModel> CreateBranch(BranchCreateModel data) { try { BranchCreateModel model = null; tblBranch dataBranch = await Task.Run(() => ManageBranch.InsertBranch(data.ConvertTotblBranch())); model = (await Task.Run(() => ManageBranch.GetBranchDetails(dataBranch.ID))).ConvertToBranch(); data.branchId = 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 ex) { throw; } }