Ejemplo n.º 1
0
        public IHttpActionResult PutMyResume(int id, MyResume myResume)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != myResume.Id)
            {
                return(BadRequest());
            }

            db.Entry(myResume).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MyResumeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutResume_Company([FromRoute] int id, [FromBody] Resume_Company Resume_Company)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != Resume_Company.ID)
            {
                return(BadRequest());
            }

            _context.Entry(Resume_Company).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Resume_CompanyExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutPersonLocation([FromRoute] int id, [FromBody] PersonLocation personLocation)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != personLocation.Id)
            {
                return(BadRequest());
            }

            _context.Entry(personLocation).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PersonLocationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public ActionResult Edit([Bind(Include = "ID,Content")] ResumeContent resumeContent)
 {
     if (ModelState.IsValid)
     {
         db.Entry(resumeContent).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(resumeContent));
 }
Ejemplo n.º 5
0
        public async Task <ActionResult> Edit([Bind(Include = "Id")] ResumeObject resumeObject)
        {
            if (ModelState.IsValid)
            {
                db.Entry(resumeObject).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(resumeObject));
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        public async Task <Maybe <Resume> > UpdateResumeAsync(Resume resume)
        {
            var exists = await ResumeExists(resume.Id);

            if (!exists)
            {
                return(Maybe.None <Resume>());
            }

            _context.Entry(resume).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(resume.ToMaybe());
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> CreateEducation(Education Model, [FromServices] ResumeContext DB)
        {
            DB.Educations.Add(Model);
            var entry = DB.Entry(Model);
            await DB.SaveChangesAsync();

            return(Prompt(x =>
            {
                x.Title = SR["Succeeded"];
                x.Details = SR["Education experience has been created successfully."];
                x.HideBack = true;
                x.RedirectText = SR["Back To Education List"];
                x.RedirectUrl = Url.Action("Education", "Admin");
            }));
        }
Ejemplo n.º 9
0
        public async Task <UsrDataShell> DataChangeAsync <TEntity>(TEntity usrData, EntityState entityState = EntityState.Modified) where TEntity : class
        {
            UsrDataShell result = new UsrDataShell();

            try{
                _resumeContext.Entry <TEntity>(usrData).State = entityState;
                int updated = await _resumeContext.SaveChangesAsync();

                if (updated == 1)
                {
                    return(result);
                }
                else
                {
                    result.Error = $"Fail {entityState.ToString()} data";
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Fail set data of DB");
                result.Error = "Fail set data of DB";
            }
            return(result);
        }
Ejemplo n.º 10
0
 public ActionResult VacancyEdit(Vacancy newvacancy)    //получаем введенные пользователем данные через модель Vacancy
 {
     db.Entry(newvacancy).State = EntityState.Modified; //устанавливаем для этой модели статус Modified
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }