Exemplo n.º 1
0
 public void Put(Reader reader)
 {
     using (IPrompterDbContext context = _dbContextFactory.Create())
     {
         context.Entry(reader).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void Post(Reader reader)
 {
     using (IPrompterDbContext context = _dbContextFactory.Create())
     {
         context.Readers.Add(reader);
         context.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public IEnumerable<Reader> Post([FromBody]object value)
 {
     JArray objects = JArray.FromObject(value, new JsonSerializer());
     Reader reader = new Reader();
     foreach(JObject read in objects.Children<JObject>())
     {
         foreach (JProperty app in read.Properties())
         {
             if (app.Name == "LastName")
                 reader.LastName = (string)app.Value;
             else if (app.Name == "FirstName")
                 reader.FirstName = (string)app.Value;
             else if (app.Name == "MiddleName")
                 reader.MiddleName = (string)app.Value;                   
         }
         actorService.Post(reader);
     }
     return Get();
 }