public ActionResult AjaxAddFav(FormCollection Fm)
 {
     if (string.IsNullOrWhiteSpace(Fm["ProductId"]))
     {
         return base.Content("False");
     }
     int num = Globals.SafeInt(Fm["ProductId"], 0);
     Maticsoft.BLL.Shop.Favorite favorite = new Maticsoft.BLL.Shop.Favorite();
     if (favorite.Exists((long) num, base.currentUser.UserID, 1))
     {
         return base.Content("Rep");
     }
     Maticsoft.Model.Shop.Favorite model = new Maticsoft.Model.Shop.Favorite {
         CreatedDate = DateTime.Now,
         TargetId = num,
         Type = 1,
         UserId = base.currentUser.UserID
     };
     if (favorite.Add(model) <= 1)
     {
         return base.Content("False");
     }
     return base.Content("True");
 }
Example #2
0
 public Maticsoft.Model.Shop.Favorite DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Shop.Favorite favorite = new Maticsoft.Model.Shop.Favorite();
     if (row != null)
     {
         if ((row["FavoriteId"] != null) && (row["FavoriteId"].ToString() != ""))
         {
             favorite.FavoriteId = int.Parse(row["FavoriteId"].ToString());
         }
         if ((row["Type"] != null) && (row["Type"].ToString() != ""))
         {
             favorite.Type = int.Parse(row["Type"].ToString());
         }
         if ((row["TargetId"] != null) && (row["TargetId"].ToString() != ""))
         {
             favorite.TargetId = long.Parse(row["TargetId"].ToString());
         }
         if ((row["UserId"] != null) && (row["UserId"].ToString() != ""))
         {
             favorite.UserId = int.Parse(row["UserId"].ToString());
         }
         if (row["Tags"] != null)
         {
             favorite.Tags = row["Tags"].ToString();
         }
         if (row["Remark"] != null)
         {
             favorite.Remark = row["Remark"].ToString();
         }
         if ((row["CreatedDate"] != null) && (row["CreatedDate"].ToString() != ""))
         {
             favorite.CreatedDate = DateTime.Parse(row["CreatedDate"].ToString());
         }
     }
     return favorite;
 }