Esempio n. 1
0
        public async Task <bool> UpdateCall(DTOCall call)
        {
            Call mapCall = _mapper.Map <Call>(call);

            _callRepository.Update(mapCall);

            bool success = true;

            try
            {
                await _callRepository.SaveChanges();
            }
            catch
            {
                if (!_callRepository.CallExists(call.CallID))
                {
                    success = false;
                }
                else
                {
                    throw;
                }
            }

            return(success);
        }
        public async Task <ActionResult <DTOCall> > GetCall(int id)
        {
            DTOCall call = await _service.GetCall(id);

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

            return(call);
        }
        public async Task <IActionResult> AddCall(DTOCall call)
        {
            bool success = await _service.AddCall(call);

            if (success)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
        public async Task <IActionResult> UpdateCall(DTOCall call)
        {
            bool success = await _service.UpdateCall(call);

            if (success)
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
Esempio n. 5
0
        public async Task <bool> AddCall(DTOCall call)
        {
            Call mapCall = _mapper.Map <Call>(call);

            _callRepository.Add(mapCall);
            bool success = true;

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

            return(success);
        }