public ActionResult updateTechnicalTip(TechnicTip dat, int id) { try { var data = db.TechnicTips.Where(x => x.tipsId == id).First(); if (data != null) { data.Title = dat.Title; data.VedioPath = dat.VedioPath; data.shortDes = dat.shortDes; data.longDes = dat.longDes; db.Entry(data).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewBag.Message = "Data Successfully Updated"; ModelState.Clear(); } } catch (Exception ex) { ViewBag.Message = "Not Submitted"; return(View()); } return(RedirectToAction("viewTechnicalTips", "Home")); }
public ActionResult TechnicalTips(tbl_technicalTipsValidation tips) { try { TechnicTip tech = new TechnicTip(); tech.Role_Id = Convert.ToInt32(Session["RoleId"]); tech.Title = tips.Title; tech.VedioPath = tips.VedioPath; tech.shortDes = tips.shortDes; tech.statusId = 2; tech.longDes = tips.longDes; tech.UserId = Convert.ToInt32(Session["Cliente"]); tech.CreatedDate = DateTime.Now; db.TechnicTips.Add(tech); db.SaveChanges(); ModelState.Clear(); ViewBag.Message = "Data Submitted"; } catch (Exception ex) { ViewBag.Message = "Not Submitted"; return(View()); } return(View()); }
public JsonResult DeleteTechnicalTips(int tipsid) { bool resul = false; TechnicTip sc = db.TechnicTips.SingleOrDefault(x => x.tipsId == tipsid); if (sc != null) { db.TechnicTips.Remove(sc); db.SaveChanges(); resul = true; } return(Json(resul, JsonRequestBehavior.AllowGet)); }