Beispiel #1
0
 public ActionResult Create(Mentor mentor)
 {
     if (ModelState.IsValid)
     {
         var entity = new Mentor
         {
             M_Name = mentor.M_Name
         };
         db.Mentors.Add(entity);
         db.SaveChanges();
         mentor.M_Id = entity.M_Id;
         try
         {
             var User_Entity = new Login_user
             {
                 M_Id       = mentor.M_Id,
                 U_Name     = mentor.M_Name,
                 U_Role     = "Mentor",
                 U_Password = mentor.M_Name,
             };
             db.Login.Add(User_Entity);
             db.SaveChanges();
         }
         catch (Exception e)
         {
         }
         return(RedirectToAction("Index"));
     }
     return(View());
 }
        public ActionResult Create([DataSourceRequest]DataSourceRequest request, ProjectAssignment projectAssignments)
        {
           try
            {
                var entity = new ProjectAssignment
                {
                    O_Id = projectAssignments.O_Id,
                    P_Id = projectAssignments.P_Id,
                    M_Id = projectAssignments.M_Id,
                    PA_Rotation_Num = projectAssignments.PA_Rotation_Num,
                    PA_Start_Date = projectAssignments.PA_Start_Date,
                    PA_End_Date = projectAssignments.PA_End_Date
                };
                db.ProjectAssignments.Add(entity);
                db.SaveChanges();
                projectAssignments.PA_Id = entity.PA_Id;
                ViewBag.msg = "Assigned";
                return View("Create");

            }
            catch (Exception e1)
            {
                ViewBag.msg = "Assignment of same project to onboarder";
                return View("Create");
            }
        }
        public ActionResult Mentors_Create([DataSourceRequest] DataSourceRequest request, Mentor mentor)
        {
            if (ModelState.IsValid)
            {
                var entity = new Mentor
                {
                    M_Name = mentor.M_Name
                };
                db.Mentors.Add(entity);
                db.SaveChanges();
                mentor.M_Id = entity.M_Id;
                try
                {
                    var User_Entity = new Login_user
                    {
                        M_Id       = mentor.M_Id,
                        U_Name     = mentor.M_Name,
                        U_Role     = "Mentor",
                        U_Password = mentor.M_Name,
                    };
                    db.Login.Add(User_Entity);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                }
            }

            return(Json(new[] { mentor }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult ReportingManagers_Create([DataSourceRequest] DataSourceRequest request, ReportingManager reportingManager)
        {
            if (ModelState.IsValid)
            {
                var entity = new ReportingManager
                {
                    RM_Name = reportingManager.RM_Name
                };

                db.ReportingManagers.Add(entity);
                db.SaveChanges();
                reportingManager.RM_Id = entity.RM_Id;
            }

            return(Json(new[] { reportingManager }.ToDataSourceResult(request, ModelState)));
        }
        public ActionResult Create([DataSourceRequest] DataSourceRequest request, Project project)
        {
            if (ModelState.IsValid)
            {
                var entity = new Project
                {
                    P_Name       = project.P_Name,
                    P_Technology = project.P_Technology
                };

                db.Projects.Add(entity);
                db.SaveChanges();
                project.P_Id = entity.P_Id;

                return(View("Index"));
            }

            return(View());
        }
 public ActionResult Add(Onboarder onboarder)
 {
     if (onboarder.O_Name == null)
     {
         ViewBag.msg = "*Name is compulsory!!!";
         return(View("Index"));
     }
     onboarder.O_Rotation_Num = 1;
     db.Onboarders.Add(onboarder);
     db.SaveChanges();
     return(View("Index"));
 }