public async Task <IActionResult> Edit(AdvertisimentUpdateViewModel model) { if (!ModelState.IsValid) { return(View(model)); } Advertisiment advertisiment = new Advertisiment() { CompanyId = _userManager.GetUserId(User), //AdvertisimentId = model.AdvertisimentId, JobTitle = model.JobTitle, City = model.City, JobDesc = model.JobDesc, NumberOfStudents = model.NumberOfStudents, CreateDate = DateTime.Now }; //await _advertisimentService.DeleteAdvertisiment(model.AdvertisimentId); //await _advertisimentService.UpdateAdvertisiment(advertisiment); var affedtedRowCount = await _advertisimentService.UpdateAdvertisiment(advertisiment); ViewBag.AffectedRowCount = affedtedRowCount; return(View(model)); }
public async Task <IActionResult> Edit(int id) { var entity = await _advertisimentService.GetById(id); var model = new AdvertisimentUpdateViewModel() { CompanyId = _userManager.GetUserId(User), AdvertisimentId = entity.AdvertisimentId, JobTitle = entity.JobTitle, City = entity.City, JobDesc = entity.JobDesc, NumberOfStudents = entity.NumberOfStudents, }; return(View(model)); }