Example #1
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="obj"></param>
		/// <returns></returns>
		public Stat Add(Stat obj)
		{
			Stat stat = null;
			using (Entities model = new Entities())
			{
				stat = model.Stats.Add(obj);
				model.SaveChanges();
			}

			return stat;
		}
Example #2
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="obj"></param>
		/// <returns></returns>
		public Url Add(Url obj)
		{
			Url addedUrl = null;

			using (Entities model = new Entities())
			{
				addedUrl = model.Urls.Add(obj);
				model.SaveChanges();
			}

			return addedUrl;
		}
Example #3
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="obj"></param>
		/// <returns></returns>
		public Url Delete(Url obj)
		{
			Url deletedUrl = null;

			using (Entities model = new Entities())
			{
				model.Urls.Attach(obj);
				model.Entry(obj).State = System.Data.Entity.EntityState.Deleted;
				model.SaveChanges();
			}

			return deletedUrl;
		}
Example #4
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="obj"></param>
		/// <returns></returns>
		public Url Update(Url obj)
		{
			Url url = null;

			using (Entities model = new Entities())
			{
				url = model.Urls.Attach(obj);
				model.Entry(obj).State = System.Data.Entity.EntityState.Modified;
				model.SaveChanges();
			}

			return url;
		}