public async Task <IActionResult> Create(TraineeShipDto pTraineeshipDto) { using (var httpClient = new HttpClient()) { var content = new StringContent(JsonConvert.SerializeObject(pTraineeshipDto), Encoding.UTF8, "application/json"); var response = await httpClient.PostAsync($"http://localhost:50106/api/v1/Traineeships/", content); } return(RedirectToAction("Index")); }
public void EditTraineeship(TraineeShipDto pTraineeshipDto) { var toModifyAsTraineeship = _paraContext.Traineeships.Select(s => s).Where(s => s.ID == pTraineeshipDto.Traineeshipid).FirstOrDefault(); toModifyAsTraineeship.StartDate = pTraineeshipDto.TraineeShipStartDate; toModifyAsTraineeship.EndDate = pTraineeshipDto.TraineeShipEndDate; toModifyAsTraineeship.Price = pTraineeshipDto.TraineeShipPrice; toModifyAsTraineeship.LicenseID = pTraineeshipDto.LicenseId; _paraContext.Traineeships.Update(toModifyAsTraineeship); _paraContext.SaveChanges(); }
public void CreateTraineeship(TraineeShipDto pTraineeshipDto) { _paraContext.Traineeships.Add(new Models.Traineeship { StartDate = pTraineeshipDto.TraineeShipStartDate, EndDate = pTraineeshipDto.TraineeShipEndDate, LicenseID = pTraineeshipDto.LicenseId, Price = pTraineeshipDto.TraineeShipPrice, IsActive = true }); _paraContext.SaveChanges(); }
public async Task <ActionResult <TraineeShipDto> > EditTraineeship([FromBody] TraineeShipDto pTraineeshipDto) { _TraineeshipService.EditTraineeship(pTraineeshipDto); return(Ok()); }