p align="justify">}
Репозиторії для товаровSystem; System.Collections.Generic; System.Linq; System.Web;
FurnitureCatalog.Models
{class ItemsRepository
{FurnitureModelDataContext _datacontext;
ItemsRepository (FurnitureModelDataContext datacontext)
{
_datacontext = datacontext;
}
IEnumerable GetItems ()
{_datacontext.Items.OrderBy (c => c.ItemName);
}
IEnumerable GetItemsNotSort ()
{_datacontext.Items.OrderBy (c => c.ItemId);
}
Items GetItem (int itemId)
{_datacontext.Items.SingleOrDefault (s => s.ItemId == itemId);
}
Items CreateItem (string itemName, string description)
{S = new Items {ItemName = itemName, Description = description};
_datacontext.Items.InsertOnSubmit (S);
_datacontext.SubmitChanges (); S;
}
void UpdateItem (Items s)
{dbItem = GetItem (s.ItemId);. ItemName = s.ItemName;. SellerId = s.SellerId;. ProducerId = s.ProducerId;. StateId = s.StateId;. Description = s . Description;
_datacontext.SubmitChanges ();
}
void DeleteItem (int ItemId)
{s = GetItem (ItemId);
_datacontext.Items.DeleteOnSubmit (s);
}
}
}
Репозиторії для продавцовSystem;
using System.Collections.Generic; System.Linq; System.Web;
FurnitureCatalog.Models
{class SellersRepository
{FurnitureModelDataContext _datacontext;
SellersRepository (FurnitureModelDataContext datacontext)
{
_datacontext = datacontext;
}
IEnumerable GetSellers ()
{_datacontext.Sellers.OrderBy (c => c.SellerName);
}
IEnumerable GetSellersReverse ()
{_datacontext.Sellers.OrderByDescending (c => c.SellerName);
}
Sellers GetSeller (int sellerId)
{_datacontext.Sellers.SingleOrDefault (s => s.SellerId == sellerId);
}
Sellers CreateSeller (string sellerName, string description, string contacts)