partial void DeleteGift(Gift instance);
partial void InsertGift(Gift instance);
partial void UpdateGift(Gift instance);
public int Insert(GiftModelShow item, HttpPostedFileBase file, string vid, HttpServerUtilityBase Server) { var Picture = ""; s26webDataContext db = new s26webDataContext(); if (file != null) if (file.ContentLength > 0 && file.ContentType.ToLower() == "image/jpeg" || file.ContentType == "image/png") Picture = Method.Upload_File(file, vid, Server); else Picture = ""; try { Gift new_item = new Gift { MemberType = item.MemberType, Name = item.Name, Point = item.Point, Amount = item.Amount, Picture = Picture, Display = item.Display, CreateTime = DateTime.UtcNow }; db.Gift.InsertOnSubmit(new_item); db.SubmitChanges(); db.Connection.Close(); return new_item.Id; } catch { return -1; } }