public JsonResult GetTypeById(int Id_Type) { TypeDisk vc = db.Types.Where(x => x.Id_TypeDisk == Id_Type).FirstOrDefault(); string value = string.Empty; value = JsonConvert.SerializeObject(vc, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); return(Json(value, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateTypeInDatabase(int Id_Type, double RentPrice, int MaxDate) { TypeDisk d = db.Types.Where(x => x.Id_TypeDisk == Id_Type).FirstOrDefault(); if (d != null) { d.RentPrice = RentPrice; d.MaxDate = MaxDate; db.SaveChanges(); return(Json(true, JsonRequestBehavior.AllowGet)); } else { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetTypeByTitle(int Id_Title) { TypeDisk vc = db.Titles.Where(x => x.Id_Title == Id_Title).First().TypeDisk; return(Json(vc.NameType, JsonRequestBehavior.AllowGet)); }