public ActionResult Create(MediaType mediatype)
        {
            if (!Authorization.GetAccess(table, HttpContext.User.Identity.Name, write))
                return RedirectToAction("Index", "Home");
            if (ModelState.IsValid)
            {
                mediatype.ID = Guid.NewGuid();
                mediatype.CreatedBy = Guid.Parse(Session["userid"].ToString());
                mediatype.CreatedOn = DateTime.Now;
                db.MediaTypes.AddObject(mediatype);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CreatedBy = new SelectList(db.Users, "ID", "UserName", mediatype.CreatedBy);
            ViewBag.ModifiedBy = new SelectList(db.Users, "ID", "UserName", mediatype.ModifiedBy);
            return View(mediatype);
        }
 /// <summary>
 /// Create a new MediaType object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="mediaType1">Initial value of the MediaType1 property.</param>
 public static MediaType CreateMediaType(global::System.Guid id, global::System.String mediaType1)
 {
     MediaType mediaType = new MediaType();
     mediaType.ID = id;
     mediaType.MediaType1 = mediaType1;
     return mediaType;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the MediaTypes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMediaTypes(MediaType mediaType)
 {
     base.AddObject("MediaTypes", mediaType);
 }