示例#1
0
        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 }));
            }
        }
示例#2
0
 /// <summary>
 /// update HocKyNamHoc
 /// </summary>
 /// <param name="entity">HocKyNamHoc</param>
 public void Update(HocKyNamHoc entity)
 {
     _HocKyNamHocRepository.Update(entity);
 }
示例#3
0
 /// <summary>
 /// delete HocKyNamHoc
 /// </summary>
 /// <param name="entity">HocKyNamHoc</param>
 public void Delete(HocKyNamHoc entity)
 {
     _HocKyNamHocRepository.Delete(entity);
 }
示例#4
0
 /// <summary>
 /// add HocKyNamHoc
 /// </summary>
 /// <param name="entity">HocKyNamHoc</param>
 public void Insert(HocKyNamHoc entity)
 {
     _HocKyNamHocRepository.Insert(entity);
 }