예제 #1
0
        public IActionResult InsertBranch([FromBody] BranchRequestDTO branch)
        {
            int ret = branchLogic.Insert(branch);

            return(ret > 0
                ? (IActionResult)Ok(ret)
                : BadRequest());
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
 public IActionResult UpdateBranch([FromQuery] int branchId, [FromBody] BranchRequestDTO branch)
 {
     branchLogic.Update(branchId, branch);
     return(Ok());
 }