public async Task <EnterpriseBranch> EditBranch(EditBranchParameters enterpriseBranch)
        {
            var branch = (await context.Enterprises.Include(i => i.Branches).FirstOrDefaultAsync(enterprise => enterprise.Id == enterpriseBranch.EnterpriseId)).Branches.Where(i => i.Id == enterpriseBranch.BranchId).FirstOrDefault();

            branch.Name     = enterpriseBranch.Name;
            branch.City     = enterpriseBranch.City;
            branch.Country  = enterpriseBranch.Country;
            branch.Street   = enterpriseBranch.Street;
            branch.StreetNo = enterpriseBranch.StreetNo;
            branch.ZipCode  = enterpriseBranch.ZipCode;

            return(branch);
        }
        public async Task <EnterpriseBranch> EditBranch(EditBranchParameters enterpriseBranch)
        {
            try
            {
                var temp = await repo.EditBranch(enterpriseBranch);

                if (temp != null)
                {
                    await unitOfWork.CompleteAsync();
                }
                return(temp);
            }
            catch
            {
                return(null);
            }
        }
        public async Task <IActionResult> EditBranch(EditBranchParameters enterpriseBranch)
        {
            if (ModelState.IsValid)
            {
                var temp = await branchService.EditBranch(enterpriseBranch);

                if (temp != null)
                {
                    return(Ok(temp));
                }
                else
                {
                    return(BadRequest(new { Message = "Something went wrong. Please, try again later." }));
                }
            }
            else
            {
                return(BadRequest(new { Message = "Invalid parameters supplied." }));
            }
        }