コード例 #1
0
        private void btnSaveGrade_Click(object sender, RoutedEventArgs e)
        {
            if (DeletedGradeList != null)
            {
                foreach (var item in DeletedGradeList)
                {
                    GradeRepo.Remove(item.GradeID);
                }
            }
            if (GradeList != null)
            {
                foreach (var item in GradeList)
                {
                    item.updated_by = item.created_by = UserID;

                    if (item.isNew)
                    {
                        GradeRepo.Insert(item);
                    }
                    else
                    {
                        GradeRepo.Update(item);
                    }
                }
            }
            RefreshList();
        }
コード例 #2
0
        public IHttpActionResult AddGrade(GradeDto grade)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            gradeRepo.Insert(Mapper.Map <Grade>(grade));

            return(CreatedAtRoute("AddGrade", new { id = grade.GradeId }, grade));
        }