public async Task <bool> UpdateWorkAccount(DTOWorkAccount workAccount)
        {
            WorkAccount mapWorkAccount = _mapper.Map <WorkAccount>(workAccount);
            await _workAccountRepository.Update2(mapWorkAccount);

            bool success = true;

            try
            {
                await _workAccountRepository.SaveChanges();
            }
            catch (Exception e)
            {
                if (!_workAccountRepository.WorkAccountExists(workAccount.WorkAccountID))
                {
                    success = false;
                }
                else
                {
                    throw;
                }
            }

            return(success);
        }
        public async Task <ActionResult <DTOWorkAccount> > GetConsumer(int id)
        {
            DTOWorkAccount workAccount = await _service.GetWorkAccount(id);

            if (workAccount == null)
            {
                return(NotFound());
            }

            return(workAccount);
        }
        public async Task <IActionResult> UpdateWorkAccount(DTOWorkAccount workAccount)
        {
            bool success = await _service.UpdateWorkAccount(workAccount);

            if (success)
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
        public async Task <IActionResult> AddWorkAccount(DTOWorkAccount workAccount)
        {
            bool success = await _service.AddWorkAccount(workAccount);

            if (success)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <bool> AddWorkAccount(DTOWorkAccount workAccount)
        {
            WorkAccount mapWorkAccount = _mapper.Map <WorkAccount>(workAccount);

            _workAccountRepository.Add(mapWorkAccount);
            bool success = true;

            try
            {
                await _workAccountRepository.SaveChanges();
            }
            catch
            {
                success = false;
            }

            return(success);
        }