Пример #1
0
 public vWallDetail GetWallDetailById( int id )
 {
     using( MinyDataContext ctx = new MinyDataContext() )
     {
         return ctx.vWallDetails.Where( x => x.WallId == id ).FirstOrDefault();
     };
 }
Пример #2
0
 public IEnumerable<vItem> GetWallItemsById( int id )
 {
     using( MinyDataContext ctx = new MinyDataContext() )
     {
         return ctx.vItems.Where( x => x.WallId == id ).ToList();
     };
 }
Пример #3
0
 public vItem GetItemById( int id )
 {
     using(MinyDataContext ctx = new MinyDataContext())
     {
         return ctx.vItems.Where( x => x.ItemId == id ).FirstOrDefault();
     }
 }
Пример #4
0
 public bool DeleteItem( int itemToDelete )
 {
     using(MinyDataContext ctx = new MinyDataContext())
     {
         try
         {
             ctx.sDeleteItem( itemToDelete );
             return true;
         }
         catch
         {
             return false;
         }
     }
 }
Пример #5
0
 public int CreateItem( CreateItemViewModel model )
 {
     using(MinyDataContext ctx = new MinyDataContext())
     {
         try
         {
             System.Nullable<int> CreatedItemId = ctx.sCreateItem( model.WallId, model.AuthorId, model.Note, model.Url, model.PicturePath, model.VideoPath, model.NbCol ).First();
             if(CreatedItemId.HasValue) { return CreatedItemId.Value; }
             return 0;
         }
         catch
         {
             return 0;
         }
     }
 }