public async Task <ServiceResponeCode> DeleteAsync(int id)
        {
            if (id == 0)
            {
                return(ServiceResponeCode.INVALID);
            }
            try
            {
                await _orderDetailRepository.DeleteAsync(id);

                return(ServiceResponeCode.OK);
            }
            catch
            {
                return(ServiceResponeCode.ERROR);
            }
        }
Example #2
0
        public async Task <ActionResult> Delete(Guid id)
        {
            try
            {
                var result = orderDetailRepo.Retrieve().FirstOrDefault(x => x.OrderDetailID == id);
                if (result == null)
                {
                    return(NotFound());
                }

                await orderDetailRepo.DeleteAsync(id);

                return(NoContent());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }