Beispiel #1
0
        public JsonResult Create(long FieldId)
        {
            StudentFieldRelationship studentField = new StudentFieldRelationship();

            studentField.StudentID = studentService.GetByMasv(Session["Username"].ToString()).ID;
            studentField.FieldID   = FieldId;
            return(Json(StudentFieldService.Create(studentField), JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
 public bool Update(StudentFieldRelationship model)
 {
     try
     {
         if (model == null)
         {
             return(false);
         }
         var update = studentFieldDAL.Update(model);
         return(update);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #3
0
        public bool Update(StudentFieldRelationship model)
        {
            try
            {
                //Initialization empty item
                var item = context.StudentFieldRelationships.Where(i => i.ID == model.ID).FirstOrDefault();

                //Set value for item with value from model
                item.StudentID = model.StudentID;
                item.FieldID   = model.FieldID;


                //Save change to database
                context.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #4
0
        public bool Create(StudentFieldRelationship model)
        {
            try
            {
                //Initialization empty item
                var item = new StudentFieldRelationship();

                //Set value for item with value from model
                item.StudentID = model.StudentID;
                item.FieldID   = model.FieldID;


                //Add item to entity
                context.StudentFieldRelationships.Add(item);
                //Save to database
                context.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }