Beispiel #1
0
        public Task <int> InsertAsync(IPYarnTypeModel model)
        {
            model.FlagForCreate(_identityProvider.Username, UserAgent);
            _iPYarnTypeDbSet.Add(model);

            return(_dbContext.SaveChangesAsync());
        }
 /// <summary>
 /// Used For dbModelto viewmodel
 /// </summary>
 private IPYarnTypeViewModel MappingViewModel(IPYarnTypeModel modelDb)
 {
     return(new IPYarnTypeViewModel
     {
         Id = modelDb.Id,
         Code = modelDb.Code,
         YarnType = modelDb.YarnType
     });
 }
Beispiel #3
0
        public Task <int> UpdateAsync(int id, IPYarnTypeModel newModel)
        {
            var modelToUpdate = _iPYarnTypeDbSet.Where(s => s.Id == id);

            foreach (var model in modelToUpdate)
            {
                model.SetCode(newModel.Code, _identityProvider.Username, UserAgent);
                model.SetYarnType(newModel.YarnType, _identityProvider.Username, UserAgent);
                _iPYarnTypeDbSet.Update(model);
            }
            return(_dbContext.SaveChangesAsync());
        }