/// <summary>
        /// Deletes the resume.
        /// </summary>
        /// <param name="resume">The resume.</param>
        public static void DeleteResume(Resume resume)
        {
            if (resume==null||resume.Id<1)
                throw new CustomException("Invalid resume argument","Can`t delete resume");

            Resume.Delete(resume);
            Context.SaveChanges();
        }
Esempio n. 2
0
        public Model.Resume AddOrUpdateResume(Resume resume)
        {
            if (resume.Id != default(int))
            {
                context.Resumes.Attach(resume);
                context.Entry(resume).State = System.Data.EntityState.Modified;
            }
            else
            {
                context.Resumes.Add(resume);
            }

            return resume;
        }
        /// <summary>
        /// Adds the resume.
        /// </summary>
        /// <param name="resume">The resume.</param>
        public static int AddResume(Resume resume)
        {
            if (resume == null ||
                resume.Client == null ||
                resume.Client.Id < 1 ||
                string.IsNullOrEmpty(resume.Title) ||
                string.IsNullOrEmpty(resume.Description))
                throw new CustomException("Invalid resume argument","Can`t add resume, some important parametrs were lost");

            Resume.Add(resume);
            Context.SaveChanges();
            var resumeId = Resume.GetLast(resume.Client.Login);

            if (resume.Fields != null)
            {
                foreach (var x in resume.Fields.SelectMany(item => item.Theme))
                {
                    x.ResumeId = resumeId;
                }
                ResumeThemeService.Add(resume.Fields);
            }

            return resumeId;
        }
 /// <summary>
 /// Adds the fields.
 /// </summary>
 /// <param name="resume">The resume.</param>
 private static void AddFields(Resume resume)
 {
     resume.Fields = ResumeThemeService.GetResumeFields(resume.Id);
 }
        /// <summary>
        /// Updates the resume.
        /// </summary>
        /// <param name="resume">The resume.</param>
        public static void UpdateResume(Resume resume)
        {
            if (resume == null ||
                string.IsNullOrEmpty(resume.Title) ||
                string.IsNullOrEmpty(resume.Description))
                throw new CustomException("Invalid resume argument","Can`t update resume");

            Resume.Update(resume);
            Context.SaveChanges();
        }
Esempio n. 6
0
 public void DeleteResume(Resume resume)
 {
     context.Resumes.Remove(resume);
 }