Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 public string?GetLiege(Date date)
 {
     if (InternalHistory.GetFieldValue("liege", date) is string liegeStr)
     {
         return(liegeStr);
     }
     return(null);
 }
Exemplo n.º 3
0
 public string?GetGovernment(Date date)
 {
     if (InternalHistory.GetFieldValue("government", date) is string govStr)
     {
         return(govStr);
     }
     return(null);
 }
Exemplo n.º 4
0
    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
        });
Exemplo n.º 5
0
    public string GetHolderId(Date date)
    {
        var idFromHistory = InternalHistory.GetFieldValue("holder", date);

        if (idFromHistory is not null)
        {
            return(idFromHistory.ToString() !);
        }
        return("0");
    }
Exemplo n.º 6
0
 public void SetInternalHistory(InternalHistory internalHistory)
 {
     _dbContext.InternalHistory.Add(internalHistory);
 }
Exemplo n.º 7
0
 public string?GetGovernment(Date date)
 {
     return(InternalHistory.GetSimpleFieldValue("government", date));
 }