public ReturnType AddConsumerVisit(List <ConsumerVisit> consumervisitList)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             foreach (ConsumerVisit consumervisit in consumervisitList)
             {
                 var u1 = alading.Consumer.FirstOrDefault(c => c.nick == consumervisit.ConsumerNick);
                 if (u1 != null)
                 {
                     u1.last_visit = consumervisit.VisitTime;
                     alading.AddToConsumerVisit(consumervisit);
                 }
             }
             alading.SaveChanges();
             return(ReturnType.Success);
         }
     }
     catch (SqlException sex)
     {
         return(ReturnType.ConnFailed);
     }
     catch (Exception ex)
     {
         return(ReturnType.OthersError);
     }
 }
 public ReturnType AddConsumerVisit(ConsumerVisit consumervisit)
 {
     try
     {
         using (AladingEntities alading = new AladingEntities(AppSettings.GetConnectionString()))
         {
             var u1 = alading.Consumer.FirstOrDefault(c => c.nick == consumervisit.ConsumerNick);
             if (u1 == null)
             {
                 return(ReturnType.NotExisted);
             }
             else
             {
                 u1.last_visit = consumervisit.VisitTime;
                 alading.AddToConsumerVisit(consumervisit);
                 if (alading.SaveChanges() == 2)
                 {
                     return(ReturnType.Success);
                 }
                 else
                 {
                     return(ReturnType.PropertyExisted);
                 }
             }
         }
     }
     catch (SqlException sex)
     {
         return(ReturnType.ConnFailed);
     }
     catch (Exception ex)
     {
         return(ReturnType.OthersError);
     }
 }