Exemple #1
0
        public async Task<IHttpActionResult> PutContent( Guid id, Content content )
        {
            if( !ModelState.IsValid )
            {
                return BadRequest( ModelState );
            }

            if( id != content.Id )
            {
                return BadRequest( );
            }

            db.Entry( content ).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync( );
            }
            catch( DbUpdateConcurrencyException )
            {
                if( !ContentExists( id ) )
                {
                    return NotFound( );
                }
                else
                {
                    throw;
                }
            }

            return StatusCode( HttpStatusCode.NoContent );
        }
Exemple #2
0
 public TaskViewModel(Content content)
 {
     ItemId = content.Id.ToString();
     Title = content.Title;
     Description = content.Description;
     datePublish = content.DateOfPublish;
     dateFinish = DateTime.Now.AddMonths(1);
     //foreach( var item in content.SubContents )
     //{
     //    ( this.SubTask as List<TaskViewModel> ).Add( new TaskViewModel( item ) );
     //}
     Done = false;
 }
Exemple #3
0
 public ContentViewModel( Content content )
 {
     this.AuthorPublish = content.AuthorPublish.UserName;
     this.SubContents = new List<ContentViewModel>( );
     foreach( var item in content.SubContents )
     {
         ( this.SubContents as List<ContentViewModel> ).Add( new ContentViewModel( item ) );
     }
     this.DateOfPublish = content.DateOfPublish;
     this.Description = content.Description;
     this.Title = content.Title;
     this.Type = content.Type;
     this.Value = content.Value;
 }