"> {S = new Sellers {SellerName = sellerName, Description = description, Contacts = contacts, CountryId = 1, BusinessTypeId = 1, ProducerId = 1};
_datacontext.Sellers.InsertOnSubmit (S);
_datacontext.SubmitChanges (); S;
}
void UpdateSeller (Sellers s)
{dbSeller = GetSeller (s.SellerId);. SellerName = s.SellerName;
dbSeller.BusinessTypeId = s.BusinessTypeId;. Contacts = s.Contacts;. CountryId = s.CountryId;. Description = s.Description;
_datacontext.SubmitChanges ();
}
void DeleteSeller (int sellerId)
{s = GetSeller (sellerId);
_datacontext.Sellers.DeleteOnSubmit (s);
_datacontext.SubmitChanges ();
}
}
}
Репозиторії для проізводітелейSystem; System.Collections.Generic; System.Linq; System.Web;
FurnitureCatalog.Models.Repositories
{class ProducersRepository
{FurnitureModelDataContext _datacontext;
ProducersRepository (FurnitureModelDataContext datacontext)
{
_datacontext = datacontext;
}
IEnumerable GetProducers ()
{_datacontext.Producers.OrderBy (c => c.ProducerName);
}
IEnumerable GetProducersReverse ()
{_datacontext.Producers.OrderByDescending (c => c.ProducerName);
}
Producers GetProducer (int producerId)
{_datacontext.Producers.SingleOrDefault (s => s.ProducerId == producerId);
}
Producers CreateProducer (string producerName, string description, string contacts)
{S = new Producers {ProducerName = producerName, Description = description, Contacts = contacts, CountryId = 1, FurnitureTypeId = 1};
_datacontext.Producers.InsertOnSubmit (S);
_datacontext.SubmitChanges (); S;
}
void UpdateProducer (Producers s)
{dbProducer = GetProducer (s.ProducerId);. ProducerName = s.ProducerName;. FurnitureTypeId = s.FurnitureTypeId;. Contacts = s.Contacts;. CountryId = s.CountryId;. Description = s . Description;
_datacontext.SubmitChanges ();
}
void DeleteProducer (int producerId)
{s = GetProducer (producerId);
_datacontext.Producers.DeleteOnSubmit (s);