Beispiel #1
0
        public JsonResult AddFacultyy(string facid, string proid)
        {
            db.Configuration.ProxyCreationEnabled = false;

            //adding into table
            long fac_id = Convert.ToInt64(facid);
            long pro_id = Convert.ToInt64(proid);

            bool IsExist = db.HRMS_ProgramFaculty.Any(x => x.ProgramID == pro_id && x.FacultyID == fac_id);

            if (!IsExist)
            {
                HRMS_Faculty_MS obj = db.HRMS_Faculty_MS.Where(x => x.ID == fac_id).FirstOrDefault();

                HRMS_ProgramFaculty obj1 = new HRMS_ProgramFaculty();
                obj1.FacultyID   = fac_id;
                obj1.FacultyName = obj.External_Name;
                obj1.Email       = obj.Email;
                obj1.ProgramID   = pro_id;

                db.HRMS_ProgramFaculty.Add(obj1);
                db.SaveChanges();


                //List<HRMS_ProgramFaculty> FacList = db.HRMS_ProgramFaculty.Where(x => x.ProgramID == pro_id).ToList();
                var FacList = pro_id;
                return(Json(FacList, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var FacList = "Faculty Already Exist!";
                return(Json(FacList, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #2
0
        //delete faculty
        public bool deletefaculty(long id)
        {
            HRMS_ProgramFaculty fac = db.HRMS_ProgramFaculty.Find(id);

            if (fac != null)
            {
                db.HRMS_ProgramFaculty.Remove(fac);
                db.SaveChanges();
                //ModelState.Clear();

                return(true);
            }
            else
            {
                return(false);
            }
        }