Exemplo n.º 1
0
 /// <summary>
 /// Adds object for POST request
 /// </summary>
 /// <param name="item">Model.MoviePersons.MoviePerson</param>
 /// <returns>context.MoviePerson_Insert</returns>
 public int Add(Model.MoviePersons.MoviePerson item)
 {
     using (var context = new AngularJsSampleDbEntities())
     {
         return(context.MoviePerson_Insert(item.FirstName, item.LastName, item.Birthday, item.BirthPlace, item.Biography,
                                           item.UserCreated?.Id, item.PhotoUrl, item.IMDBUrl, item.Popularity));
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Adds id for UPDATE request
 /// </summary>
 /// <param name="item">Model.MoviePersons.MoviePerson</param>
 /// <returns>Model.MoviePersons.MoviePerson</returns>
 public Model.MoviePersons.MoviePerson Save(Model.MoviePersons.MoviePerson item)
 {
     using (var context = new AngularJsSampleDbEntities())
     {
         context.MoviePerson_Save(item.Id, item.FirstName, item.LastName,
                                  item.BirthPlace, item.Birthday, item.Biography,
                                  item.PhotoUrl, item.IMDBUrl, item.Popularity,
                                  item.UserLastModified?.Id);
         return(item);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds object for DELETE request
 /// </summary>
 /// <param name="item">Model.MoviePersons.MoviePerson</param>
 /// <returns>System.Boolean</returns>
 public bool Delete(Model.MoviePersons.MoviePerson item)
 {
     try
     {
         using (var context = new AngularJsSampleDbEntities())
         {
             context.MoviePerson_Delete(item.Id, item.UserLastModified?.Id);
             return(true);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine($"The exception is: '{e}'");
         return(false);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Maps Model.MoviePerson.MoviePerson into Messaging.Views.MoviePerson.MoviePerson
 /// </summary>
 /// <param name="model">Model.MoviePerson.MoviePerson</param>
 /// <returns>Messaging.Views.MoviePerson.MoviePerson</returns>
 public static Messaging.Views.MoviePersons.MoviePerson MapToView(this Model.MoviePersons.MoviePerson model)
 {
     return(Mapper.Map <Messaging.Views.MoviePersons.MoviePerson>(model));
 }