public StudentResources UpdateSingleResource(StudentResources resource)
 {
     using (var db = new SqlConnection(ConnectionString))
     {
         var updatedResource = db.QueryFirstOrDefault <StudentResources>(@"update StudentResources
                                 set title = @title,
                                     description = @description,
                                     url = @url
                                     output inserted.*
                                     where id = @id",
                                                                         new
         {
             id          = resource.Id,
             title       = resource.Title,
             description = resource.Description,
             url         = resource.Url
         });
         return(updatedResource);
     }
     throw new System.Exception("Could not update question.");
 }
Ejemplo n.º 2
0
        public ActionResult UpdateSingleResource(StudentResources resource)
        {
            var updateSingleResource = _studentResourcesRepository.UpdateSingleResource(resource);

            return(Ok(updateSingleResource));
        }