public ActionResult QuickAttachment() { Applicant applicant; //The normal binding does not work var id = RouteData.Values["id"] as string; var name = Request.Form["name"] as string; if (id == null) { applicant = new Applicant(name); RavenSession.Store(applicant); } else { applicant = RavenSession.Load<Applicant>(id); if (applicant == null) return HttpNotFound(); } using (var attachmentReader = new RequestAttachmentReader(Request)) { var attachments = attachmentReader .Select(x => ExecuteCommand(new SaveAttachment(applicant, x.Key, x.Value))) .ToArray(); var notes = attachments.Select(x => new NoteWithAttachment() { Attachment = x, Note = "QuickAttachment!", RealDate = DateTime.Now, RegisterDate = DateTime.Now }); if (applicant.Notes == null) { applicant.Notes = notes.ToList(); } else { applicant.Notes.AddRange(notes); } return Json(new { success = true, entityId = applicant.Id, editUrl = Url.Action("Edit", new { id = applicant.Id }), attachment = attachments.FirstOrDefault(), attachments = attachments }); } }
public ActionResult Create(string name) { var newApplicant = new Applicant(name); RavenSession.Store(newApplicant); return RedirectToAction("Edit", new { id = newApplicant.Id }); }
private JObject GetApplicantJsonWithModifiedDate(Applicant applicant) { var lastModified = RavenSession.Advanced.GetMetadataFor(applicant).Value<DateTime>("Last-Modified"); var jsonApplicant = Newtonsoft.Json.Linq.JObject.FromObject(applicant); jsonApplicant["Last-Modified"] = lastModified; return jsonApplicant; }
private void GenerateApplicant(Postulation postulation) { //TODO: move it to an Action var applicant = new Applicant() { JobSearchId = postulation.JobSearchId, Email = postulation.Email, FirstName = postulation.FirstName, LastName = postulation.LastName }; RavenSession.Store(applicant); applicant.Notes = new List<ApplicantNote>(); if (postulation.Curriculum != null) { var curriculum = GenerateAttachment(applicant, postulation.Curriculum); applicant.AddGeneralNote("Currículum", curriculum); } if (!string.IsNullOrEmpty(postulation.Comment)) { applicant.AddGeneralNote("Nota de postulación:\n\n" + postulation.Comment); } //TODO change this when links are in place if (!string.IsNullOrEmpty(postulation.LinkedInUrl)) { applicant.AddGeneralNote("Perfil de LinkedIn: " + postulation.LinkedInUrl); } }
public JsonNetResult Post(Applicant applicant) { RavenSession.Store(applicant); return Get(applicant.Id); }
private void GenerateApplicant(Postulation postulation) { //TODO: move it to an Action var applicant = new Applicant() { JobSearchId = postulation.JobSearchId, Email = postulation.Email, FirstName = postulation.FirstName, LastName = postulation.LastName, TechnicalSkills = postulation.TechnicalSkills, LinkedInLink = postulation.LinkedInUrl }; RavenSession.Store(applicant); applicant.Notes = new List<NoteWithAttachment>(); if (postulation.Curriculum != null) { var curriculum = GenerateAttachment(applicant, postulation.Curriculum); applicant.AddGeneralNote("Currículum", curriculum); } if (!string.IsNullOrEmpty(postulation.Comment)) { applicant.AddGeneralNote("Nota de postulación:\n\n" + postulation.Comment); } }