public StuffItemViewModel(StuffItem stuffItem)
 {
     Id = stuffItem.Id;
     Name = stuffItem.Name;
     LentTo = stuffItem.LentTo ?? string.Empty;
     DateAdded = stuffItem.Added.ToString("dd MMM yyyy");
     StuffCategory = new StuffCategoryViewModel(stuffItem.StuffCategory);
 }
        public void Post(NewStuffItem item)
        {
            using(_profilerWrapper.Step("Add new stuff item"))
            {
                var stuff = new StuffItem { Name = item.Name, StuffCategory = new StuffCategory{ Id = item.Category }};

                _stuffItemRepository.Add(stuff);
            }
        }
Exemple #3
0
        public void AddNew(string name, int category)
        {
            using (_profilerWrapper.Step("Stuff Add New Item Action"))
            {
                var stuff = new StuffItem { Name = name, StuffCategory = new StuffCategory { Id = category } };

                _stuffItemRepository.Add(stuff);
            }
        }
 public void Add(StuffItem stuff)
 {
     using (_profilerWrapper.Step("Add stuff item to database"))
     {
         _connection.Execute(INSERT_NEW_STUFF_ITEM_AND_RETURN_SQL,
                                                                new
                                                                    {
                                                                        stuff.Name,
                                                                        CategoryID = stuff.StuffCategory.Id
                                                                    });
     }
 }