public async Task <OperationResult <bool> > UpdateAsync(Establishment establishment)
        {
            try
            {
                if (_dao.ListAsync().Result.Any(x => x.Address.ToLower().Trim() == establishment.Address.ToLower().Trim() && x.Id != establishment.Id && !x.IsDeleted))
                {
                    return new OperationResult <bool>()
                           {
                               Success = true, Result = false, Message = "Address already exists"
                           }
                }
                ;
                await _dao.UpdateAsync(establishment);

                return(new OperationResult <bool>()
                {
                    Success = true, Result = true
                });
            }
            catch (Exception e)
            {
                return(new OperationResult <bool>()
                {
                    Success = false, Exception = e
                });
            }
        }
Beispiel #2
0
        public async Task <OperationResult> UpdateAsync(Establishment establishment)
        {
            try
            {
                await _dao.UpdateAsync(establishment);

                return(new OperationResult()
                {
                    Success = true
                });
            }
            catch (Exception e)
            {
                return(new OperationResult()
                {
                    Success = true, Exception = e
                });
            }
        }