/// <summary>
 /// Used for viewmodel to dbmodel
 /// </summary>
 private IPYarnTypeModel MappingDbModel(IPYarnTypeViewModel viewModel)
 {
     return(new IPYarnTypeModel(viewModel.Code, viewModel.YarnType));
 }
        public Task <int> Create(IPYarnTypeViewModel model)
        {
            var mappingModel = MappingDbModel(model);

            return(_repository.InsertAsync(mappingModel));
        }
 public Task <int> Update(int id, IPYarnTypeViewModel model)
 {
     return(_repository.UpdateAsync(id,
                                    MappingDbModel(model)));
 }