public bool AddFollowers(PhotoGrapherFollower Flw) { var client = Db.PhotoGrapherFollowers.Where(x => x.Fk_Client_id == Flw.Fk_Client_id && x.Fk_PhotoGrapher_ID == Flw.Fk_PhotoGrapher_ID).SingleOrDefault(); if (client == null) { Db.Set <PhotoGrapherFollower>().Add(Flw); Db.SaveChanges(); return(true); } else { return(false); } }
public ActionResult Follow(PhotoGrapherFollower flw) { var result = social.AddFollowers(flw); if (result == true) { // TempData["msg"] = "<script>alert('You Followed This PhotoGrapher');</script>"; //Current Url Redirect return(Redirect(HttpContext.Request.UrlReferrer.AbsoluteUri)); } else { //TempData["msg"] = "<script>alert('You Already Follows This PhotoGrapher');</script>"; //Current Url Redirect return(Redirect(HttpContext.Request.UrlReferrer.AbsoluteUri)); } }