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; } }
public async Task DeleteBranch(BranchCreateModel data) { try { switch (data.companyType) { case "MSP": await Task.Run(() => ManageMSP.DeleteMSPLocationBranch(data.id, "Branch")); break; case "Customer": await Task.Run(() => ManageCustomer.DeleteCustomerLocationBranch(data.id, "Branch")); break; case "Supplier": await Task.Run(() => ManageSupplier.DeleteSupplierBranchLocation(data.id, "Branch")); break; } await Task.Run(() => ManageBranch.DeleteBranch(data.id)); } catch (Exception) { throw; } }
public async Task <BranchCreateModel> UpdateBranch(BranchCreateModel model) { try { tblBranch data = await Task.Run(() => ManageBranch.UpdateBranch(model.ConvertTotblBranch())); return(data.ConvertToBranch()); } catch (Exception) { throw; } }
public async Task <IHttpActionResult> creatBranch(BranchCreateModel data) { try { userId = User.Identity.GetUserId(); Helpers.Helpers.AddBaseProperties(data, "create", userId); return(Ok(await BranchService.CreateBranch(data))); } catch (Exception) { throw; } }
public async Task <IHttpActionResult> DeleteBranch(BranchCreateModel data) { try { await BranchService.DeleteBranch(data); return(Ok("Success")); } catch (Exception) { throw; } }
public IActionResult Add(BranchCreateModel newBranch) { LibraryBranch asset = new LibraryBranch(); asset.Name = newBranch.BranchName; asset.Address = newBranch.Address; asset.Telephone = newBranch.Telephone; asset.Description = newBranch.Description; asset.ImageUrl = newBranch.ImageUrl; _branchService.Add(asset); return(View("./SuccessAdd")); }
public static tblSupplierLocationBranch ConvertTotblSupplierLocationBranch(this BranchCreateModel data) { return(new tblSupplierLocationBranch() { ID = Convert.ToInt64(data.id), SupplierID = data.companyId, LocationID = data.locationId, BranchID = data.branchId, IsActive = data.isActive, IsDeleted = data.isDeleted ?? false, CreatedUserID = data.createdUserID, UpdatedUserID = data.updatedUserID, CreatedTimestamp = data.createdTimestamp ?? DateTime.Now, UpdatedTimestamp = data.updatedTimestamp ?? DateTime.Now }); }
public static tblBranch ConvertTotblBranch(this BranchCreateModel data) { return(new tblBranch() { ID = Convert.ToInt64(data.id), BranchName = data.branchName, LocationID = data.locationId, EmailAddress = data.emailAddress, PhoneNumber = data.phoneNumber, StreetLine1 = data.streetLine1, StreetLine2 = data.streetLine2, City = data.city, StateID = Convert.ToInt16(data.stateId), CountryID = Convert.ToInt16(data.countryId), IsActive = data.isActive, IsDeleted = data.isDeleted ?? false, CreatedUserID = data.createdUserID, UpdatedUserID = data.updatedUserID, CreatedTimestamp = data.createdTimestamp ?? DateTime.Now, UpdatedTimestamp = data.updatedTimestamp ?? DateTime.Now }); }
public ActionResult AddBranch(BranchCreateModel branch) { var response = service.Create(branch); return(Ok(response)); }