public string RemoveEditorPick(int productID, string status) { try { EditorPick pick = db.EditorPicks.Where(e => e.ProductId == productID).FirstOrDefault(); if (pick != null) { db.EditorPicks.Remove(pick); db.SaveChanges(); return(Constant.ST_OK); } else { return(Constant.ST_OK); } } catch (Exception) { return(Constant.ST_NG); } }
public string AddEditorPick(int productID) { try { EditorPick pick = db.EditorPicks.Where(e => e.ProductId == productID).FirstOrDefault(); if (pick != null) { return(Constant.ST_OK); } else { pick = new EditorPick(); pick.ProductId = productID; db.EditorPicks.Add(pick); db.SaveChanges(); return(Constant.ST_OK); } } catch (Exception) { return(Constant.ST_NG); } }