예제 #1
0
 public static void Insert(StudentsGroupsModel model)
 {
     try
     {
         using (AppContext db = new AppContext())
         {
             db.StudentsGroupsSet.Add(model);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.ToString());
     }
 }
예제 #2
0
        public ContentResult AddStudent(StudentsGroupsModel model)
        {
            if (ModelState.IsValid)
            {
                InsertStudent.Insert(model);

                return(new ContentResult
                {
                    StatusCode = (int)HttpStatusCode.OK
                });
            }
            else
            {
                return(new ContentResult
                {
                    StatusCode = (int)HttpStatusCode.InternalServerError
                });
            }
        }