public string GetAttachPhotoID() { AttachPhoto attachphoto = new AttachPhoto(); var mylist = this.ListAttachPhoto().ToList(); if (mylist.Count == 0) { attachphoto.AttachPhotoID = "0000000001"; } else { string s = ((from x in mylist select new { x.AttachPhotoID }).Last()).AttachPhotoID.ToString(); int lastint = Int32.Parse(s.Substring(0, 10)) + 1; string myid = String.Format("{0:0000000000}", lastint); string autoid = myid.ToString(); attachphoto.AttachPhotoID = autoid; } return(attachphoto.AttachPhotoID); }
public void Add(AttachPhoto attachphoto) { db.AttachPhotos.InsertOnSubmit(attachphoto); }