Ejemplo n.º 1
0
        public void UpdateContent(CONTENTS content)
        {
            var dbcontent = _context.CONTENTS.FirstOrDefault(x => x.ID == content.ID);

            dbcontent.HEAD        = content.HEAD;
            dbcontent.CONTENTTEXT = content.CONTENTTEXT;
            dbcontent.UPDATEDATE  = DateTime.Now;
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
        public void Insert(InsertContentRequest request)
        {
            CONTENTS content = new CONTENTS()
            {
                CATEGORIID  = request.CategoriId,
                CONTENTTEXT = request.ContentText,
                HEAD        = request.ContentHead,
                //CONTENTFILE=request.ContentFile
                INSERTDATE = DateTime.Now,
                STATUS     = 1,
                USERID     = 1
            };

            _context.CONTENTS.Add(content);
            _context.SaveChanges();
        }
Ejemplo n.º 3
0
 public void Update(CONTENTS content)
 {
     if (content.ID == 0)
     {
         _context.CONTENTS.Add(content);
         _context.SaveChanges();
     }
     else
     {
         var data = _context.CONTENTS.FirstOrDefault(x => x.ID == content.ID);
         data.HEAD        = content.HEAD;
         data.CONTENTTEXT = content.CONTENTTEXT;
         data.UPDATEDATE  = DateTime.Now;
         _context.SaveChanges();
     }
 }
Ejemplo n.º 4
0
        public ActionResult UpdateList(CONTENTS content)
        {
            contentrepository.Update(content);

            return(RedirectToAction("List"));
        }
Ejemplo n.º 5
0
        public userMessages(Google.Apis.Gmail.v1.Data.Message mess, string folder)
        {
            ID = mess.Id;

            FOLDER = folder;


            if (mess.Payload.Parts == null && mess.Payload.Body != null)
            {
                try
                {
                    CONTENTS = mess.Payload.Body.Data;
                    String codedBody = CONTENTS.Replace("-", "+");
                    codedBody = codedBody.Replace("_", "/");
                    byte[] data = Convert.FromBase64String(CONTENTS);
                    CONTENTS = Encoding.UTF8.GetString(data);
                }
                catch
                {
                    CONTENTS = getNestedParts(mess.Payload.Parts, "");
                }
            }
            else
            {
                try
                {
                    CONTENTS = getNestedParts(mess.Payload.Parts, "");
                }
                catch
                {
                    CONTENTS = mess.Payload.Body.ToString();
                }
            }

            //headders
            foreach (MessagePartHeader prt in mess.Payload.Headers)
            {
                if (prt.Name == "Date")
                {
                    DATE = DateTime.Parse(prt.Value);
                }
                else if (prt.Name == "From")
                {
                    FROM = prt.Value;
                }
                else if (prt.Name == "Sender")
                {
                    SENDER = prt.Value;
                }
                else if (prt.Name == "Reply-To")
                {
                    REPLYTO = prt.Value;
                }
                else if (prt.Name == "To")
                {
                    TO = prt.Value;
                }
                else if (prt.Name == "Subject")
                {
                    SUBJECT = prt.Value;
                }
            }
            TITLE = FROM + " :: " + SUBJECT;



            String getNestedParts(IList <MessagePart> part, string curr)
            {
                string str = curr;

                if (part == null)
                {
                    return(str);
                }
                else
                {
                    foreach (var parts in part)
                    {
                        if (parts.Parts == null)
                        {
                            if (parts.Body != null && parts.Body.Data != null)
                            {
                                String codedBody = parts.Body.Data.Replace("-", "+");
                                codedBody = codedBody.Replace("_", "/");
                                byte[] data = Convert.FromBase64String(codedBody);
                                codedBody = Encoding.UTF8.GetString(data);
                                str      += codedBody;
                            }
                        }
                        else
                        {
                            return(getNestedParts(parts.Parts, str));
                        }
                    }

                    return(str);
                }
            }
        }