public Task <int> InsertAsync(WarpTypeModel model)
        {
            model.FlagForCreate(_identityProvider.Username, UserAgent);
            _dbSet.Add(model);

            return(_dbContext.SaveChangesAsync());
        }
        public Task <int> UpdateAsync(int id, WarpTypeModel model)
        {
            var modelToUpdate = _dbSet.FirstOrDefault(s => s.Id == id);

            modelToUpdate.SetType(model.Type, _identityProvider.Username, UserAgent);
            modelToUpdate.SetCode(model.Code, _identityProvider.Username, UserAgent);

            return(_dbContext.SaveChangesAsync());
        }
Beispiel #3
0
        private WarpTypeViewModel MapToViewModel(WarpTypeModel model)
        {
            var vm = new WarpTypeViewModel()
            {
                LastModifiedUtc = model.LastModifiedUtc,
                Type            = model.Type,
                Code            = model.Code,
                Id                = model.Id,
                Active            = model.Active,
                CreatedAgent      = model.CreatedAgent,
                CreatedBy         = model.CreatedBy,
                CreatedUtc        = model.CreatedUtc,
                DeletedAgent      = model.DeletedAgent,
                DeletedBy         = model.DeletedBy,
                DeletedUtc        = model.DeletedUtc,
                IsDeleted         = model.IsDeleted,
                LastModifiedAgent = model.LastModifiedAgent,
                LastModifiedBy    = model.LastModifiedBy
            };

            return(vm);
        }
Beispiel #4
0
        public Task <int> Create(WarpTypeViewModel viewModel)
        {
            var model = new WarpTypeModel(viewModel.Type, viewModel.Code);

            return(_repository.InsertAsync(model));
        }
Beispiel #5
0
        public Task <int> Update(int id, WarpTypeViewModel viewModel)
        {
            var model = new WarpTypeModel(viewModel.Type, viewModel.Code);

            return(_repository.UpdateAsync(id, model));
        }