コード例 #1
0
        public bool DeleteMessageByGuid(MessageFilter filter)
        {
            bool success = true;

            try
            {
                using (var db = new EntryContext())
                {
                    var query = from m in db.MessageTracks
                                .Include("Entry301s")
                                .Include("Entry302s")
                                .Include("Entry501s")
                                .Include("Entry502s")
                                .Include("Entry503s")
                                .Include("Entry504s")
                                .Include("Entry601s")
                                .Include("Entry602s")
                                where m.ItemGuid == filter.Guid
                                select m;
                    db.Entry(query.FirstOrDefault()).State = System.Data.Entity.EntityState.Deleted;
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                Logs.Error("DeleteMessageByGuid Exception: " + ex.ToString());
                success = false;
            }
            return(success);
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "EntryId,Prompt,Title,Text")] Entry entry)
 {
     if (ModelState.IsValid)
     {
         db.Entry(entry).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(entry));
 }