コード例 #1
0
        public async Task <HttpResponseMessage> DeleteVetVisit(VetVisitDeleteRequest request)
        {
            client.DefaultRequestHeaders.Add("Access-Control-Allow-Origin", "*");
            client.DefaultRequestHeaders.Add("Access-Control-Allow-Credentials", "true");
            client.DefaultRequestHeaders.Add("Access-Control-Allow-Headers", "Access-Control-Allow-Origin,Content-Type");
            var serialized    = System.Text.Json.JsonSerializer.Serialize(request);
            var stringContent = new StringContent(serialized, Encoding.UTF8, "application/json");
            var result        = await client.PostAsync($"/VetVisit/delete", stringContent);

            return(result);
        }
コード例 #2
0
 public bool DeleteVetVisit(VetVisitDeleteRequest request)
 {
     using (ISession session = NHibernateSession.OpenSession())
     {
         VetVisit foundVetVisit = session.Query <VetVisit>().FirstOrDefault(c => c.VetVisitId == request.VetVisitId.Value);
         if (foundVetVisit == null)
         {
             return(false);
         }
         foundVetVisit.Deleted = DateTime.UtcNow;
         using (ITransaction transaction = session.BeginTransaction()) //  Begin a transaction
         {
             session.Update(foundVetVisit);                            //  Save the user in session
             transaction.Commit();                                     //  Commit the changes to the database
         }
     }
     return(true);
 }
コード例 #3
0
 public bool Delete([FromBody] VetVisitDeleteRequest request)
 {
     return(_VetVisitManager.DeleteVetVisit(request));
 }
コード例 #4
0
ファイル: VetVisitManager.cs プロジェクト: scottcl88/BenjiAPI
 public bool DeleteVetVisit(VetVisitDeleteRequest request)
 {
     return(_VetVisitsRepository.DeleteVetVisit(request));
 }