コード例 #1
0
        public ActionResult EditFieldActivity(EditFieldActivityViewModel model)
        {
            var fildAct = db.FieldActivities.Include(f => f.Resumes).FirstOrDefault(i => i.Id == model.FieldActivityId);

            var resumeUpdate = db.Resumes.Include(r => r.FieldActivities)
                               .FirstOrDefault(i => i.FieldActivities.Where(f => f.FieldActivityId == model.FieldActivityId) != null);
            var upFieldResume = resumeUpdate.FieldActivities.FirstOrDefault(f => f.FieldActivityId == fildAct.Id);



            if (model.FieldActivityId != null)
            {
                upFieldResume.FieldActivity = fildAct;
            }

            resumeUpdate.DateChange = DateTime.Now;

            db.FieldsActivityResume.Update(upFieldResume);
            db.Resumes.Update(resumeUpdate);
            db.SaveChanges();

            return(RedirectToAction("Edit", "Resume", new { resumeId = resumeUpdate.Id }));
        }
コード例 #2
0
        // --------------- EDIT -------------
        // EditFieldActivity and NameRes
        public ActionResult EditFieldActivity(Guid resumeId, Guid fieldActId)
        {
            var resume = db.Resumes.Include(r => r.FieldActivities)
                         .FirstOrDefault(i => i.FieldActivities.Where(f => f.FieldActivityId == fieldActId) != null);

            var field = db.FieldActivities.Include(f => f.Resumes).FirstOrDefault(i => i.Id == fieldActId);

            var model = new EditFieldActivityViewModel()
            {
                FieldActivityId   = field.Id,
                Resume            = resume,
                FieldActivityName = field.Name
            };

            model.FieldActivities = db.FieldActivities.Include(f => f.Resumes)
                                    .Select(e => new SelectListItem()
            {
                Value = e.Id.ToString(),
                Text  = e.Name
            }).ToList();


            return(View("/Arrea/Candidate/Views/Resumes/EditResume/EditFieldActivity.cshtml", model));
        }