Ejemplo n.º 1
0
        public HttpResponseMessage UpdateProject([FromBody] project_tb prj)
        {
            if (prj != null)
            {
                db.AllProjects.Attach(prj);
                var entry = db.Entry(prj);
                entry.Property(e => e.title).IsModified          = true;
                entry.Property(e => e.description).IsModified    = true;
                entry.Property(e => e.duration).IsModified       = true;
                entry.Property(e => e.category).IsModified       = true;
                entry.Property(e => e.project_status).IsModified = true;
                entry.Property(e => e.ytubeLink).IsModified      = true;

                if (prj.base64 != "null")
                {
                    string       base64Data = Convert.ToString(prj.base64);
                    base64ToByte baseBytes  = new base64ToByte();
                    prj.imageData = baseBytes.image(840, 540, base64Data);
                    prj.thumbnail = baseBytes.image(310, 210, base64Data);
                    entry.Property(e => e.imageData).IsModified = true;
                    entry.Property(e => e.thumbnail).IsModified = true;
                }

                db.SaveChanges();
                return(Request.CreateResponse(HttpStatusCode.OK, "Successfully updated."));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NoContent, "Unable to update."));
            }
        }
Ejemplo n.º 2
0
        public HttpResponseMessage UpdateRecord([FromBody] successStories_tb stories)
        {
            if (stories != null)
            {
                db.successStories.Attach(stories);
                var entry = db.Entry(stories);

                entry.Property(e => e.title).IsModified       = true;
                entry.Property(e => e.description).IsModified = true;
                entry.Property(e => e.ytubeLink).IsModified   = true;


                if (stories.base64 != "null")
                {
                    string       base64Data = Convert.ToString(stories.base64);
                    base64ToByte baseBytes  = new base64ToByte();
                    stories.imageData = baseBytes.image(840, 540, base64Data);
                    stories.thumbnail = baseBytes.image(310, 210, base64Data);

                    entry.Property(e => e.imageData).IsModified = true;
                    entry.Property(e => e.thumbnail).IsModified = true;
                }
                db.SaveChanges();
                return(Request.CreateResponse(HttpStatusCode.OK, "Successfully Updated."));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NoContent, "Unable to update."));
            }
        }
Ejemplo n.º 3
0
        public string UpdateRecord(string ID, successStories_tb stories)
        {
            if (stories != null)
            {
                db.successStories.Attach(stories);
                var entry = db.Entry(stories);

                entry.Property(e => e.title).IsModified       = true;
                entry.Property(e => e.description).IsModified = true;
                entry.Property(e => e.ytubeLink).IsModified   = true;


                if (stories.base64 != "null")
                {
                    string       base64Data = Convert.ToString(stories.base64);
                    base64ToByte baseBytes  = new base64ToByte();
                    stories.imageData = baseBytes.image(840, 540, base64Data);
                    stories.thumbnail = baseBytes.image(310, 210, base64Data);

                    entry.Property(e => e.imageData).IsModified = true;
                    entry.Property(e => e.thumbnail).IsModified = true;
                }
                db.SaveChanges();
                return("Successfully Updated");
            }
            else
            {
                return("Invalid Record");
            }
        }
Ejemplo n.º 4
0
        public HttpResponseMessage Put([FromBody] Gallery gallery)
        {
            try
            {
                db.gallery.Attach(gallery);
                var entry = db.Entry(gallery);
                entry.Property(e => e.caption).IsModified   = true;
                entry.Property(e => e.ytubeLink).IsModified = true;

                if (gallery.base64 != "null")
                {
                    string       base64Data = Convert.ToString(gallery.base64);
                    base64ToByte baseBytes  = new base64ToByte();
                    gallery.image     = baseBytes.image(840, 540, base64Data);
                    gallery.thumbnail = baseBytes.image(310, 210, base64Data);
                    entry.Property(e => e.image).IsModified     = true;
                    entry.Property(e => e.thumbnail).IsModified = true;
                }

                db.SaveChanges();
                return(Request.CreateResponse(HttpStatusCode.OK, gallery));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Ejemplo n.º 5
0
        public HttpResponseMessage SaveStories([FromBody] successStories_tb stories)
        {
            string       base64Data = Convert.ToString(stories.base64);
            base64ToByte baseBytes  = new base64ToByte();

            stories.imageData = baseBytes.image(840, 540, base64Data);
            stories.thumbnail = baseBytes.image(310, 210, base64Data);

            stories.date = DateTime.Now;
            db.successStories.Add(stories);
            db.SaveChanges();
            return(Request.CreateResponse(HttpStatusCode.OK, "Successfully Added."));
        }
Ejemplo n.º 6
0
        public ActionResult SaveStories(successStories_tb stories)
        {
            string       base64Data = Convert.ToString(stories.base64);
            base64ToByte baseBytes  = new base64ToByte();

            stories.imageData = baseBytes.image(840, 540, base64Data);
            stories.thumbnail = baseBytes.image(310, 210, base64Data);

            stories.date = DateTime.Now;
            db.successStories.Add(stories);
            db.SaveChanges();
            return(Json("Successfully Added", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 7
0
        public HttpResponseMessage SaveTutorial([FromBody] project_tb projects)
        {
            string       base64Data = Convert.ToString(projects.base64);
            base64ToByte baseBytes  = new base64ToByte();

            projects.imageData = baseBytes.image(840, 540, base64Data);
            projects.thumbnail = baseBytes.image(310, 210, base64Data);


            projects.posted_date = DateTime.Now;
            db.AllProjects.Add(projects);
            db.SaveChanges();
            return(Request.CreateResponse(HttpStatusCode.OK, "Successfully added."));
        }
Ejemplo n.º 8
0
 public string SaveGallery(Gallery gallery)
 {
     try
     {
         if (gallery.base64 != "null")
         {
             string       base64Data = Convert.ToString(gallery.base64);
             base64ToByte baseBytes  = new base64ToByte();
             gallery.image     = baseBytes.image(840, 540, base64Data);
             gallery.thumbnail = baseBytes.image(310, 210, base64Data);
         }
         gallery.postedDate = DateTime.Now;
         db.gallery.Add(gallery);
         db.SaveChanges();
         return("Gallery Saved");
     }
     catch (Exception ex) { return(ex.Message); }
 }
Ejemplo n.º 9
0
 public ActionResult SaveNews(news_tb everyNews)
 {
     try
     {
         if (everyNews.base64 != "null")
         {
             string       base64Data = Convert.ToString(everyNews.base64);
             base64ToByte baseBytes  = new base64ToByte();
             everyNews.image     = baseBytes.image(840, 540, base64Data);
             everyNews.thumbnail = baseBytes.image(310, 210, base64Data);
         }
         everyNews.posted_date = DateTime.Now;
         db.AllNews.Add(everyNews);
         db.SaveChanges();
         return(Json("Tutorial Saved", JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
 }
Ejemplo n.º 10
0
        public string Update(string PrjId, Gallery g)
        {
            db.gallery.Attach(g);
            var entry = db.Entry(g);

            entry.Property(e => e.caption).IsModified   = true;
            entry.Property(e => e.ytubeLink).IsModified = true;

            if (g.base64 != "null")
            {
                string       base64Data = Convert.ToString(g.base64);
                base64ToByte baseBytes  = new base64ToByte();
                g.image     = baseBytes.image(840, 540, base64Data);
                g.thumbnail = baseBytes.image(310, 210, base64Data);
                entry.Property(e => e.image).IsModified     = true;
                entry.Property(e => e.thumbnail).IsModified = true;
            }

            db.SaveChanges();
            return("Updated");
        }
Ejemplo n.º 11
0
 public HttpResponseMessage SaveNews([FromBody] news_tb everyNews)
 {
     try
     {
         if (everyNews.base64 != "null")
         {
             string       base64Data = Convert.ToString(everyNews.base64);
             base64ToByte baseBytes  = new base64ToByte();
             everyNews.image     = baseBytes.image(840, 540, base64Data);
             everyNews.thumbnail = baseBytes.image(310, 210, base64Data);
         }
         everyNews.posted_date = DateTime.Now;
         db.AllNews.Add(everyNews);
         db.SaveChanges();
         return(Request.CreateResponse(HttpStatusCode.OK, "Added Successfully."));
     }
     catch (Exception)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Unable to add."));
     }
 }
Ejemplo n.º 12
0
        public HttpResponseMessage Post([FromBody] Gallery gallery)
        {
            try
            {
                if (gallery.base64 != "null")
                {
                    string       base64Data = Convert.ToString(gallery.base64);
                    base64ToByte baseBytes  = new base64ToByte();
                    gallery.image     = baseBytes.image(840, 540, base64Data);
                    gallery.thumbnail = baseBytes.image(310, 210, base64Data);
                }
                gallery.postedDate = DateTime.Now;
                db.gallery.Add(gallery);
                db.SaveChanges();

                return(Request.CreateResponse(HttpStatusCode.OK, gallery));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Ejemplo n.º 13
0
        public string UpdateNews(string PrjId, news_tb nws)
        {
            if (nws != null)
            {
                //int no = Convert.ToInt32(tutorial.imageid);
                //var ProjectList = db.Images.Where(x => x.imageid == no).FirstOrDefault();
                ////ProjectList.imagename = tutorial.imagename;
                //db.Entry(tutorial).State = EntityState.Modified;
                //db.SaveChanges();

                db.AllNews.Attach(nws);
                var entry = db.Entry(nws);
                entry.Property(e => e.title).IsModified     = true;
                entry.Property(e => e.detail).IsModified    = true;
                entry.Property(e => e.eventDate).IsModified = true;
                entry.Property(e => e.news_type).IsModified = true;
                entry.Property(e => e.ytubeLink).IsModified = true;

                if (nws.base64 != "null")
                {
                    string       base64Data = Convert.ToString(nws.base64);
                    base64ToByte baseBytes  = new base64ToByte();
                    nws.image     = baseBytes.image(840, 540, base64Data);
                    nws.thumbnail = baseBytes.image(310, 210, base64Data);
                    entry.Property(e => e.image).IsModified     = true;
                    entry.Property(e => e.thumbnail).IsModified = true;
                }

                db.SaveChanges();
                return("News Updated");
            }
            else
            {
                return("Invalid News");
            }
        }
Ejemplo n.º 14
0
        public HttpResponseMessage UpdateNews([FromBody] news_tb nws)
        {
            if (nws != null)
            {
                //int no = Convert.ToInt32(tutorial.imageid);
                //var ProjectList = db.Images.Where(x => x.imageid == no).FirstOrDefault();
                ////ProjectList.imagename = tutorial.imagename;
                //db.Entry(tutorial).State = EntityState.Modified;
                //db.SaveChanges();

                db.AllNews.Attach(nws);
                var entry = db.Entry(nws);
                entry.Property(e => e.title).IsModified     = true;
                entry.Property(e => e.detail).IsModified    = true;
                entry.Property(e => e.eventDate).IsModified = true;
                entry.Property(e => e.news_type).IsModified = true;
                entry.Property(e => e.ytubeLink).IsModified = true;

                if (nws.base64 != "null")
                {
                    string       base64Data = Convert.ToString(nws.base64);
                    base64ToByte baseBytes  = new base64ToByte();
                    nws.image     = baseBytes.image(840, 540, base64Data);
                    nws.thumbnail = baseBytes.image(310, 210, base64Data);
                    entry.Property(e => e.image).IsModified     = true;
                    entry.Property(e => e.thumbnail).IsModified = true;
                }

                db.SaveChanges();
                return(Request.CreateErrorResponse(HttpStatusCode.OK, "Successfully updated."));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NoContent, "Unable to update."));
            }
        }