示例#1
0
 public JsonResult Add(StudentEntity entity = null)
 {
     if (entity == null)
     {
         throw new ArgumentNullException();
     }
     return(Json(_studentBusiness.Add(entity)));
 }
示例#2
0
 public ActionResult Create(Student student)
 {
     try
     {
         // TODO: Add insert logic here
         StudentBusiness.Add(student);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#3
0
 public ActionResult Create(Student model)
 {
     try
     {
         // TODO: Add insert logic here
         char c = model.FirstName.FirstOrDefault();
         model.Alias = c + model.LastName;
         StudentBusiness.Add(model);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#4
0
        public Student Add(Student student)
        {
            try
            {
                var bc = new StudentBusiness();
                return(bc.Add(student));
            }
            catch (Exception ex)
            {
                var httpError = new HttpResponseMessage()
                {
                    StatusCode   = (HttpStatusCode)422,
                    ReasonPhrase = ex.Message
                };

                throw new HttpResponseException(httpError);
            }
        }
示例#5
0
        public void Create(Student student)
        {
            var studentBussines = new StudentBusiness();

            studentBussines.Add(student);
        }