public ActionResult InternalHistory([FromBody] InternalHistoryDTO InternalHistoryDTO) { if (!ModelState.IsValid) { return(BadRequest()); } if (InternalHistoryDTO == null) { return(BadRequest()); } var checkInternalHistoryDTOIdinDb = _choiceRepoistory.GetInternalHistory().Find(c => c.InternalHistoryId == InternalHistoryDTO.InternalHistoryId); if (checkInternalHistoryDTOIdinDb != null) { return(BadRequest()); } InternalHistory newlyInternalHistoryDTO = new InternalHistory() { InternalHistoryId = InternalHistoryDTO.InternalHistoryId, History = InternalHistoryDTO.History, BookingId = InternalHistoryDTO.BookingId, CreatedDate = InternalHistoryDTO.CreatedDate, CreatedBy = InternalHistoryDTO.CreatedBy, SharepointId = InternalHistoryDTO.SharepointId, }; _choiceRepoistory.SetInternalHistory(newlyInternalHistoryDTO); _choiceRepoistory.Complete(); return(CreatedAtRoute("GetInternalHistorybyID", new { newlyInternalHistoryDTO.InternalHistoryId }, newlyInternalHistoryDTO)); }
public string?GetLiege(Date date) { if (InternalHistory.GetFieldValue("liege", date) is string liegeStr) { return(liegeStr); } return(null); }
public string?GetGovernment(Date date) { if (InternalHistory.GetFieldValue("government", date) is string govStr) { return(govStr); } return(null); }
public int?GetDevelopmentLevel(Date date) { var historyValue = InternalHistory.GetFieldValue("development_level", date); return(historyValue switch { string devStr when int.TryParse(devStr, out int dev) => dev, int devInt => devInt, _ => null });
public string GetHolderId(Date date) { var idFromHistory = InternalHistory.GetFieldValue("holder", date); if (idFromHistory is not null) { return(idFromHistory.ToString() !); } return("0"); }
public void SetInternalHistory(InternalHistory internalHistory) { _dbContext.InternalHistory.Add(internalHistory); }
public string?GetGovernment(Date date) { return(InternalHistory.GetSimpleFieldValue("government", date)); }