public string Add(CvCreateModel model) { var cv = Mapper.Map <Cv>(model); cv.UserId = GetLoggedUser(); cv.Id = ObjectId.GenerateNewId(); this.db.Cvs.InsertOneAsync(cv); return(cv.Id.ToString()); }
public IActionResult Create(CvCreateModel model) { if (!ModelState.IsValid) { return(View(model)); } try { TempData.AddSuccessMessage("Cv successfully created"); var id = this.cvs.Add(model).ToString(); return(this.RedirectToAction(nameof(PersonalInfo), new { id })); } catch (Exception ex) { return(BadRequest(ex.ToString())); } }