public async Task <int> CreateOrUpdate(CategoryDto input) { if (input.Id > 0) { // update var updateData = await _categoryRepos.GetAsync(input.Id); input.MapTo(updateData); await _categoryRepos.UpdateAsync(updateData); return(1); } else { var insertData = input.MapTo <Category>(); int id = await _categoryRepos.InsertAndGetIdAsync(insertData); return(id); } }
public async Task UpsertCategory(CategoryDto input) { try { var obj = input.MapTo <Category>(); if (input.Id == 0) { obj.IsDeleted = false; obj.CreatedBy = AbpSession.UserId; obj.DateCreated = DateTime.Now; obj.DateModified = null; } else { obj.ModifiedBy = AbpSession.UserId; obj.DateModified = DateTime.Now; } await _categoryRepository.InsertOrUpdateAsync(obj); } catch (Exception ex) { throw ex; } }
public static Category ToEntity(this CategoryDto categoryDto) { return(categoryDto.MapTo <CategoryDto, Category>()); }
public CategoryViewModel(CategoryDto output) { output.MapTo(this); }
public static Category ToEntity(this CategoryDto model, Category destination) { return(model.MapTo(destination)); }
public static Category ToEntity(this CategoryDto model) { return(model.MapTo <CategoryDto, Category>()); }
public CategoryDto Update(CategoryDto dto) { return(_categoryDomainService.Update(dto.MapTo <Category>()).MapTo <CategoryDto>()); }
public async Task CreateOrUpdateCategoryAsync(CategoryDto input) { await _categoryManager.CreateOrUpdateCategoryAsync(input.MapTo <Category>()); }