Beispiel #1
0
        public static void DeleteSketChup(ArchModelView a)
        {
            ApplicationDbContext db     = new ApplicationDbContext();
            ArchModel            delete = db.ArchModels.FirstOrDefault(x => x.Id == a.Id);

            db.ArchModels.Remove(delete);
            db.SaveChanges();
        }
Beispiel #2
0
        public static int AddSketChup(ArchModelView a)
        {
            ApplicationDbContext db  = new ApplicationDbContext();
            ArchModel            add = ModelConverter.ViewToArchModel(a);

            db.ArchModels.Add(add);
            db.SaveChanges();
            return(add.Id);
        }
 public static ArchModel ViewToArchModel(ArchModelView a)
 {
     return(new ArchModel
     {
         Id = a.Id,
         Name = a.Name,
         DownloadLink = a.DownloadLink,
         Type = a.Type,
         AddDate = a.AddDate,
         DESC = a.DESC
     });
 }
Beispiel #4
0
        public static void EditSketChup(ArchModelView a)
        {
            ApplicationDbContext db   = new ApplicationDbContext();
            ArchModel            edit = db.ArchModels.FirstOrDefault(x => x.Id == a.Id);

            edit.Name         = a.Name;
            edit.Type         = a.Type;
            edit.Id           = a.Id;
            edit.DownloadLink = a.DownloadLink;
            edit.AddDate      = a.AddDate;
            edit.DESC         = a.DESC;
            db.SaveChanges();
        }
Beispiel #5
0
        public static ArchModelView getArchModelView(int id)
        {
            ArchModelView a = ModelConverter.ArchModelToView(DBHelper.getArchModel(id));

            return(a);
        }