public async Task <LocationCreateModel> UpdateLocation(LocationCreateModel model) { try { tblLocation data = await Task.Run(() => ManageLocation.UpdateLocation(model.ConvertTotblLocation())); return(data.ConvertToLocation()); } catch (Exception) { throw; } }
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; } }