public ResponseDTO EditInformation(InformationDTO InformationDTO) { logger.LogInformation("EditInformation"); if (context.Informations.Where(b => b.Name == InformationDTO.Name).Count() == 0) { return(new ResponseDTO() { Code = 400, Message = "Information not exist", Status = "Error" }); } try { context.Informations.Update(mapper.Map <Information>(InformationDTO)); context.SaveChanges(); } catch (Exception e) { return(new ResponseDTO() { Code = 400, Message = e.Message, Status = "Error" }); } return(new ResponseDTO() { Code = 200, Message = "Updated information", Status = "Success" }); }
public ResponseDTO EditInformation(InformationDTO informationDTO) { _logger.LogInformation("Executing EditBill method"); if (_context.Information.Where(b => b.Id == informationDTO.Id).Count() == 0) { return(new ResponseDTO() { Code = 400, Message = $"Information of the user's id { informationDTO.Id} doesn't exist in db", Status = "Error" }); } try { _context.Information.Update(_mapper.Map <Information>(informationDTO)); _context.SaveChanges(); } catch (Exception e) { return(new ResponseDTO() { Code = 400, Message = e.Message, Status = "Error" }); } return(new ResponseDTO() { Code = 200, Message = "Edit information in db", Status = "Success" }); }
public ResponseDTO AddInformation(InformationDTO InformationDTO) { logger.LogInformation("AddInformation"); try { var a = mapper.Map <Information>(InformationDTO); context.Informations.Add(a); context.SaveChanges(); } catch (Exception e) { return(new ResponseDTO() { Code = 400, Message = e.Message, Status = "Error" }); } return(new ResponseDTO() { Code = 200, Message = "Added information", Status = "Success" }); }
public ResponseDTO AddInformation(InformationDTO informationDTO) { _logger.LogInformation("Executing AddInformation method"); try { _context.Information.Add(_mapper.Map <Information>(informationDTO)); _context.SaveChanges(); } catch (Exception e) { return(new ResponseDTO() { Code = 400, Message = e.Message, Status = "Error during add information" }); } return(new ResponseDTO() { Code = 200, Message = "Added information to db", Status = "Success" }); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); informationDTO = (InformationDTO)e.Parameter; TestTitleTB.Text = informationDTO.testTitle; nameTB.Text = informationDTO.patientName; PersonalIDTB.Text = informationDTO.personalID; TestIDTB.Text = informationDTO.testID; genderCB.Text = informationDTO.patientGender; dateTimeTB.Text = informationDTO.dateOfMeasurement; }
public InformationDTO GetBorrowDetails(int studentId) { using (UnitOfWork uow = new UnitOfWork()) { var borrows = uow.Borrows.Search(x => x.StudentId == studentId && x.ReturnDate == null && x.EndDate < DateTime.Now); InformationDTO info = new InformationDTO { EndDate = borrows[0].EndDate, LateDays = (DateTime.Now - borrows[0].EndDate).Days, NumberOfBooks = borrows.Count }; return(info); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); informationDTO = (InformationDTO)e.Parameter; Source.Clear(); // TODO WTS: Replace this with your actual data var data = await SampleDataService.GetChartDataAsync(); foreach (var item in data) { Source.Add(item); } }
public ActionResult POST(string name, [FromBody] InformationDTO informationDTO) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Article articles = _articleContext.Articles .Include(n => n.Informations) .OrderBy(x => x.Date) .FirstOrDefault(m => m.Name.Replace(" ", "-").ToLower() == name.ToLower());//first article in db if (articles == null) { return(NotFound()); //404 } Information article = _mapper.Map <Information>(informationDTO); articles.Informations.Add(article); _articleContext.SaveChanges(); return(Created($"api/article/{name}", null)); }
public ActionResult EditInformation([FromBody] InformationDTO informationDTO) { logger.LogInformation("Executing EditInformation controller"); return(Ok(informationsService.EditInformation(informationDTO))); }
public IActionResult AddInformation([FromBody] InformationDTO informationDTO) { _logger.LogInformation("Executing AddInformation controller"); return(Ok(_informationsService.AddInformation(informationDTO))); }
public IActionResult EditInformation([FromBody] InformationDTO InformationDTO) { logger.LogInformation("EditInformation controller"); return(Ok(informationService.EditInformation(InformationDTO))); }
private void nextB_Click(object sender, RoutedEventArgs e) { InformationDTO informationDTO = new InformationDTO(testTitleTB.Text, nameTB.Text, pIDTB.Text, testIDTB.Text, gender, Convert.ToString(dateTimeDT), strengthLevel); this.Frame.Navigate(typeof(Views.MeasurePage), informationDTO); }