public ActionResult Create(string models) { try { var namhocs = JsonConvert.DeserializeObject <IEnumerable <NamHoc> >(models); if (namhocs != null) { foreach (NamHoc namhoc in namhocs) { _NamHocService.Insert(namhoc); foreach (HocKy hocKy in _HocKyService.GetAll()) { HocKyNamHoc hocKyNamHoc = new HocKyNamHoc(); hocKyNamHoc.MaHocKy = hocKy.MaHocKy; hocKyNamHoc.MaNamHoc = namhoc.MaNamHoc; _HocKyNamHocService.Insert(hocKyNamHoc); } } } return(Json(namhocs)); } catch (Exception e) { return(Json(new { error = e.Message })); } }
/// <summary> /// update HocKyNamHoc /// </summary> /// <param name="entity">HocKyNamHoc</param> public void Update(HocKyNamHoc entity) { _HocKyNamHocRepository.Update(entity); }
/// <summary> /// delete HocKyNamHoc /// </summary> /// <param name="entity">HocKyNamHoc</param> public void Delete(HocKyNamHoc entity) { _HocKyNamHocRepository.Delete(entity); }
/// <summary> /// add HocKyNamHoc /// </summary> /// <param name="entity">HocKyNamHoc</param> public void Insert(HocKyNamHoc entity) { _HocKyNamHocRepository.Insert(entity); }