Ejemplo n.º 1
0
        public async Task <Result> DeleteAddressTypeAsync(int id)
        {
            try
            {
                var model = await GetAddressTypeAsync(id);

                if (model != null)
                {
                    var data = _iMapper.Map <AddressTypeViewModel, AddressType>(model);

                    var saveChange = await _iAddressTypeRepository.DeleteAddressTypeAsync(data);

                    if (saveChange > 0)
                    {
                        return(Result.Ok(MessageHelper.Delete));
                    }
                    else
                    {
                        return(Result.Fail(MessageHelper.DeleteFail));
                    }
                }
                else
                {
                    return(Result.Fail(MessageHelper.DeleteFail));
                }
            }
            catch (Exception)
            {
                throw;
            }
        }