Esempio n. 1
0
 public bool Update(Stadium model)
 {
     try
     {
         using (var context = new YueDongEntities())
         {
             var result = context.Stadia.FirstOrDefault(a => a.Id == model.Id);
             if (result != null)
             {
                 result.UpdateTime    = model.UpdateTime;
                 result.Address       = model.Address;
                 result.Name          = model.Name;
                 result.OpenEndTime   = model.OpenEndTime;
                 result.OpenStartTime = model.OpenStartTime;
                 result.Phone         = model.Phone;
                 result.Price         = model.Price;
             }
             return(context.SaveChanges() > 0);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Esempio n. 2
0
 public bool Insert(FreeTime model)
 {
     try
     {
         using (var context = new YueDongEntities())
         {
             context.FreeTimes.Add(model);
             return(context.SaveChanges() > 0);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Esempio n. 3
0
        public bool Insert(CommonPicture model)
        {
            try
            {
                using (var context = new YueDongEntities())
                {
                    context.CommonPictures.Add(model);

                    return context.SaveChanges() > 0;
                }
            }
            catch (Exception e)
            {

            }
            return false;
        }
Esempio n. 4
0
 public bool DeleteByUserIdAndWeekTime(FreeTime time)
 {
     try
     {
         using (var context = new YueDongEntities())
         {
             var result = context.FreeTimes.Where(a => a.Status > 0 && a.UserId == time.UserId && time.Week == a.Week.Value && a.StartTime.Value.ToString("HH:mm") == time.StartTime.Value.ToString("HH:mm") && a.EndTime.Value.ToString("HH:mm") == time.EndTime.Value.ToString("HH:mm"));
             if (result.Any())
             {
                 result.FirstOrDefault().Status = 0;
             }
             return(context.SaveChanges() > 0);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Esempio n. 5
0
 public bool Update(SportRecord model)
 {
     try
     {
         using (var context = new YueDongEntities())
         {
             var result = context.SportRecords.FirstOrDefault(a => a.Id == model.Id);
             if (result != null)
             {
                 result.UpdateTime    = model.UpdateTime;
                 result.SportLastTime = model.SportLastTime;
             }
             return(context.SaveChanges() > 0);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Esempio n. 6
0
 public bool Update(CommonPicture model)
 {
     try
     {
         using (var context = new YueDongEntities())
         {
             var result = context.CommonPictures.FirstOrDefault(a => a.Id == model.Id);
             if (result != null)
             {
                 result.CreateTime = model.CreateTime;
                 result.FileData   = model.FileData;
                 result.UserId     = model.UserId;
             }
             return(context.SaveChanges() > 0);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Esempio n. 7
0
 public bool Update(FreeTime model)
 {
     try
     {
         using (var context = new YueDongEntities())
         {
             var result = context.FreeTimes.FirstOrDefault(a => a.Id == model.Id);
             if (result != null)
             {
                 result.StartTime  = model.StartTime;
                 result.EndTime    = model.EndTime;
                 result.Week       = model.Week;
                 result.UpdateTime = model.UpdateTime;
             }
             return(context.SaveChanges() > 0);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Esempio n. 8
0
 public bool Update(CommonUser model)
 {
     try
     {
         using (var context = new YueDongEntities())
         {
             var result = context.CommonUsers.FirstOrDefault(a => a.Id == model.Id);
             if (result != null)
             {
                 result.Password   = model.Password;
                 result.Age        = model.Age;
                 result.Gender     = model.Gender;
                 result.Hobby      = model.Hobby;
                 result.NickName   = model.NickName;
                 result.UpdateTime = model.UpdateTime;
             }
             return(context.SaveChanges() > 0);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }
Esempio n. 9
0
        public bool Update(CommonPicture model)
        {
            try
            {
                using (var context = new YueDongEntities())
                {
                    var result = context.CommonPictures.FirstOrDefault(a => a.Id == model.Id);
                    if (result != null)
                    {
                        result.CreateTime = model.CreateTime;
                        result.FileData = model.FileData;
                        result.UserId = model.UserId;
                    }
                    return context.SaveChanges() > 0;
                }
            }
            catch (Exception e)
            {

            }
            return false;
        }