示例#1
0
 public bool AddTag(Tag Tag)
 {
     int affectedRows = 0;
     using (var db = new trackerwebdbEntities())
     {
         Tag.Status = 1;
         db.Tags.Add(Tag);
         affectedRows = db.SaveChanges();
     }
     return affectedRows > 0;
 }
示例#2
0
 public ActionResult Create(Tag model)
 {
     try
     {
         TagRepository repo = new TagRepository();
         repo.AddTag(model);
         return RedirectToAction("Index");
     }
     catch
     {
         return View(model);
     }
 }
示例#3
0
 public ActionResult Edit(int id, Tag model)
 {
     try
     {
         TagRepository repo = new TagRepository();
         repo.UpdateTag(model);
         return RedirectToAction("Index");
     }
     catch
     {
         return View(model);
     }
 }
示例#4
0
 public bool UpdateTag(Tag Tag)
 {
     int affectedRows = 0;
     using (var db = new trackerwebdbEntities())
     {
         //update tagid, friendly name, description and (future) image blob
         var model = db.Tags.Where(x => x.Id == Tag.Id).First();
         model.TagId = Tag.TagId;
         model.FriendlyName = Tag.FriendlyName;
         model.Description = Tag.Description;
         model.Status = Tag.Status;
         affectedRows = db.SaveChanges();
     }
     return affectedRows > 0;
 }
示例#5
0
 // GET: Tag/Create
 public ActionResult Create()
 {
     Tag model = new Tag();
     return View(model);
 }