Ejemplo n.º 1
0
        public string Post(ResumeModel newResume)
        {
            string success = "ERROR: ";

            try
            {
                using (var db = new ResumeContext())
                {
                    var r = new DataContext.Resume();
                    r.ResumeName = newResume.ResumeName;
                    r.Created    = DateTime.Now;
                    r.PersonId   = newResume.PersonId;

                    db.Resumes.Add(r);
                    db.SaveChanges();
                    success = r.Id.ToString();
                }
            }
            catch (Exception ex) { success = Helpers.ErrorDetails(ex); }
            return(success);
        }
Ejemplo n.º 2
0
        public string Put(ResumeModel resumeModel)
        {
            string success = "";

            try
            {
                using (var db = new ResumeContext())
                {
                    DataContext.Resume resume = db.Resumes.Where(r => r.Id == resumeModel.Id).FirstOrDefault();
                    if (resume != null)
                    {
                        resume.ResumeName = resumeModel.ResumeName;
                        db.SaveChanges();
                        success = "ok";
                    }
                    else
                    {
                        success = "Resume not found";
                    }
                }
            }
            catch (Exception ex) { success = Helpers.ErrorDetails(ex); }
            return(success);
        }