public IActionResult InsertBranch([FromBody] BranchRequestDTO branch) { int ret = branchLogic.Insert(branch); return(ret > 0 ? (IActionResult)Ok(ret) : BadRequest()); }
public void Update(int branchId, BranchRequestDTO entity) { Branch oldBranch = branchRepository.Get(branchId); Branch newBranch = ObjectHelpers.MapTo <Branch>(entity); newBranch.Id = branchId; ObjectHelpers.UpdateObjects(oldBranch, newBranch); branchRepository.Update(oldBranch); }
public int Insert(BranchRequestDTO entity) { Branch branch = ObjectHelpers.MapTo <Branch>(entity); branchRepository.Insert(branch).Wait(); Address address = new Address { AddressLink = entity.AddressLink, BranchId = branch.Id, StreetName = entity.StreetName, District = entity.District.ToEnum <Districts>() }; addressRepository.Insert(address); branch.AddressId = address.Id; branchRepository.Update(branch); return(branch.Id); }
public IActionResult UpdateBranch([FromQuery] int branchId, [FromBody] BranchRequestDTO branch) { branchLogic.Update(branchId, branch); return(Ok()); }