public static ArchModelView GetSketChup(int id) { ApplicationDbContext db = new ApplicationDbContext(); ArchModel edit = db.ArchModels.FirstOrDefault(x => x.Id == id && x.Type == ModelType.SKETCHUP); return(ModelConverter.ArchModelToView(edit)); }
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(); }
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 ArchModelView ArchModelToView(ArchModel a) { return(new ArchModelView { Id = a.Id, Name = a.Name, DownloadLink = a.DownloadLink, Type = a.Type, AddDate = a.AddDate, DESC = a.DESC }); }
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(); }