public async Task <ActualResult> UpdateProductSubcategoryAsync(UpdateProductSubcategoryDTO dto) { try { var mapping = _mapper.Map <DimProductSubcategory>(dto); _context.Entry(mapping).State = EntityState.Deleted; _context.Entry(mapping).State = EntityState.Modified; await _context.SaveChangesAsync(); return(new ActualResult()); } catch (Exception exception) { return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception))); } }
public async Task <ActualResult> UpdateAsync(CreateCurrencyDTO dto) { try { var mapping = _mapper.Map <DimCurrency>(dto); mapping.UpdateDate = DateTime.Now; _context.Entry(mapping).State = EntityState.Modified; _context.Entry(mapping).Property(x => x.CurrencyKey).IsModified = false; _context.Entry(mapping).Property(x => x.EtlloadId).IsModified = false; _context.Entry(mapping).Property(x => x.LoadDate).IsModified = false; await _context.SaveChangesAsync(); return(new ActualResult()); } catch (Exception exception) { return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception))); } }
public async Task <ActualResult> UpdateCustomerAsync(CustomerDTO dto) { try { var mapping = _mapper.Map <DimCustomer>(dto); _context.Entry(mapping).State = EntityState.Modified; _context.Entry(mapping).Property(x => x.CustomerKey).IsModified = false; _context.Entry(mapping).Property(x => x.GeographyKey).IsModified = false; _context.Entry(mapping).Property(x => x.CustomerLabel).IsModified = false; _context.Entry(mapping).Property(x => x.FirstName).IsModified = false; _context.Entry(mapping).Property(x => x.LastName).IsModified = false; _context.Entry(mapping).Property(x => x.MiddleName).IsModified = false; _context.Entry(mapping).Property(x => x.AddressLine2).IsModified = false; _context.Entry(mapping).Property(x => x.BirthDate).IsModified = false; _context.Entry(mapping).Property(x => x.CustomerType).IsModified = false; _context.Entry(mapping).Property(x => x.DateFirstPurchase).IsModified = false; _context.Entry(mapping).Property(x => x.EtlloadId).IsModified = false; _context.Entry(mapping).Property(x => x.HouseOwnerFlag).IsModified = false; _context.Entry(mapping).Property(x => x.NameStyle).IsModified = false; _context.Entry(mapping).Property(x => x.NumberCarsOwned).IsModified = false; _context.Entry(mapping).Property(x => x.NumberChildrenAtHome).IsModified = false; _context.Entry(mapping).Property(x => x.Suffix).IsModified = false; _context.Entry(mapping).Property(x => x.Title).IsModified = false; _context.Entry(mapping).Property(x => x.TotalChildren).IsModified = false; _context.Entry(mapping).Property(x => x.UpdateDate).IsModified = false; await _context.SaveChangesAsync(); return(new ActualResult()); } catch (Exception exception) { return(new ActualResult(DescriptionExceptionHelper.GetDescriptionError(exception))); } }