コード例 #1
0
 public static Todo Map(this Data.Model.Todo value)
 {
     if (null == value)
     {
         return(null);
     }
     return(new Todo()
     {
         Id = value.Id,
         Description = value.Description,
         IsCompleted = value.IsCompleted
     });
 }
コード例 #2
0
        public IActionResult Post(string description)
        {
            // Create //
            var todoDataModel = new Data.Model.Todo()
            {
                Description = description
            };
            var todoDtoModel = todoDataModel.Map();

            _todoRepository.Set(todoDataModel);

            // Respond //
            return(this.Ok(todoDtoModel));
        }