public ActionResult create_partial(string Userid) { var id = User.Identity.GetUserId(); var subordinate = dbasp.GetAll().Where(n => n.Id == Userid).First(); CRM_subordinate crm_subordinate = new CRM_subordinate { EmploteeID = id, UserID = subordinate.Id, Username = subordinate.Name }; //var Username = dbsub.GetAll().Where(n => n.UserID == crm_subordinate.UserID).Select(n =>new { UserID = n.Username }).First(); //crm_subordinate.Username = Username.UserID; dbsub.Create(crm_subordinate); return RedirectToAction("Index", "InterviewRecords", new { area = "CRM" }); }
public ActionResult Create([Bind(Include = "InterviewID,UserID,Interviewer_Name,Interviewee_Name,C_Type_ID,StartTime,C_Location,InterviewContent,CreateTime,LastModifyTime")] InterviewRecords interviewRecords) { var i = db.AspNetUsers.Find(User.Identity.GetUserId()); var id = User.Identity.GetUserId(); if (ModelState.IsValid) { interviewRecords.CreateTime = DateTime.Now; interviewRecords.LastModifyTime = DateTime.Now; interviewRecords.EmployeeID = id; db.InterviewRecords.Add(interviewRecords); dbinterview.Create(interviewRecords); return(RedirectToAction("Index")); } ViewBag.C_Type_ID = new SelectList(db.InterviewType, "InterviewType_ID", "TypeName", interviewRecords.C_Type_ID); return(View(interviewRecords)); }