//public virtual ObjectResult<int> Resume_Save(string name, Nullable<int> userID, string description, string summaryObjectives, string tagLine, Nullable<int> resumeID, Nullable<bool> isPublic, Nullable<int> createdByUserID, SqlParameter newID) //{ // var nameParameter = name != null ? // new SqlParameter("Name", name) : // new SqlParameter("Name", typeof(string)); // var userIDParameter = userID.HasValue ? // new SqlParameter("UserID", userID) : // new SqlParameter("UserID", typeof(int)); // var descriptionParameter = description != null ? // new SqlParameter("Description", description) : // new SqlParameter("Description", typeof(string)); // var summaryObjectivesParameter = summaryObjectives != null ? // new SqlParameter("SummaryObjectives", summaryObjectives) : // new SqlParameter("SummaryObjectives", typeof(string)); // var tagLineParameter = tagLine != null ? // new SqlParameter("TagLine", tagLine) : // new SqlParameter("TagLine", typeof(string)); // var resumeIDParameter = resumeID.HasValue ? // new SqlParameter("ResumeID", resumeID) : // new SqlParameter("ResumeID", typeof(int)); // var isPublicParameter = isPublic.HasValue ? // new SqlParameter("IsPublic", isPublic) : // new SqlParameter("IsPublic", typeof(bool)); // var createdByUserIDParameter = createdByUserID.HasValue ? // new SqlParameter("CreatedByUserID", createdByUserID) : // new SqlParameter("CreatedByUserID", typeof(int)); // return ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreQuery<int>("Resume_Save", nameParameter, userIDParameter, descriptionParameter, summaryObjectivesParameter, tagLineParameter, resumeIDParameter, isPublicParameter, createdByUserIDParameter, newID); //} public virtual Resume Resume_Save(string name, Nullable<int> userID, string description, string summaryObjectives, string tagLine, Nullable<int> resumeID, Nullable<bool> isPublic, Nullable<int> createdByUserID, SqlParameter newID) { //using (NuvolaResumeContext context = new NuvolaResumeContext()) { Resume item = new Resume(); if (resumeID.HasValue) { //Find the item item = Resume_Get(resumeID.Value); } else { //Create a new item, we don't have an ID item = new Resume(); } //Update / Set properties item.UserID = userID.Value; item.Name = name; item.Description = description; item.SummaryObjectives = summaryObjectives; item.TagLine = tagLine; item.IsPublic = isPublic; item.CreatedBy = createdByUserID; if (resumeID.HasValue) { //Add the new item to the database _context.Resumes.Add(item); } _context.SaveChanges(); return (item); } }
public ActionResult Edit(Resume item) { return (View(item)); }
//public virtual ObjectResult<Resume_Get_Result> Resume_Get(Nullable<int> resumeID) //{ // var resumeIDParameter = resumeID.HasValue ? // new SqlParameter("ResumeID", resumeID) : // new SqlParameter("ResumeID", typeof(int)); // return ((IObjectContextAdapter)this).ObjectContext.ExecuteStoreQuery<Resume_Get_Result>("Resume_Get", resumeIDParameter); //} public virtual Resume Resume_Get(int id) { Resume item = new Resume(); if (id < 1) return (item); //using (NuvolaResumeContext context = new NuvolaResumeContext()) { //Find the item item = _context.Resumes.SingleOrDefault(x => x.ID == id); return (item); } }