Exemple #1
0
        public bool Delete(MediaViewModel dt, int id)
        {
            Media dr = db.Media.Where(i => i.medID == id).FirstOrDefault();

            db.Media.Remove(dr);
            var Result = db.SaveChanges();

            return(Result == 1);
        }
Exemple #2
0
        public bool Update(MediaViewModel dt, int id)
        {
            Media dr = db.Media.Where(i => i.medID == id).FirstOrDefault();

            dr.medID       = dt.ID;
            dr.medFileName = dt.FileName;
            dr.medType     = dt.FileType;
            var Result = db.SaveChanges();

            return(Result == 1);
        }
Exemple #3
0
        public int Insert(MediaViewModel dt)
        {
            Media dr = new Media();

            dr.medFileName = dt.FileName;
            dr.medType     = dt.FileType;
            db.Media.Add(dr);
            var Result = db.SaveChanges();

            return(dr.medID);
        }