Esempio n. 1
0
        /// <summary>
        /// 更新預約資訊
        /// </summary>
        /// <param name="clientData"></param>
        /// <returns></returns>
        public static bool Update(Interview.Models.Container.ClientData clientData)
        {
            try
            {
                using (var context = new HouseRulesEntities())
                {
                    //var item = context.ClientData.FirstOrDefault(x => x.ID == clientData.ID);
                    var item = context.ClientData.FirstOrDefault(x => x.ID == clientData.ID);

                    if (item == null)
                    {
                        return(false);
                    }

                    item.ClientName = clientData.ClientName;
                    item.Sex        = clientData.Sex;
                    item.City       = clientData.City;
                    item.Address    = clientData.Address;
                    item.Mobile     = clientData.Mobile;
                    item.Budget     = clientData.Budget;
                    item.UpdateDate = DateTime.Now;

                    context.SaveChanges();
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 新增後台帳號
 /// </summary>
 /// <param name="userAccount"></param>
 /// <returns></returns>
 public static bool Insert(Interview.Models.Container.AdminAccount userAccount)
 {
     try
     {
         using (var context = new HouseRulesEntities())
         {
             context.AdminAccount.Add(userAccount);
             context.SaveChanges();
             return(true);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 新增預約資訊
 /// </summary>
 /// <param name="clientData"></param>
 /// <returns></returns>
 public static bool Insert(Interview.Models.Container.ClientData clientData)
 {
     try
     {
         using (var context = new HouseRulesEntities())
         {
             clientData.CreateDate = DateTime.Now;
             clientData.UpdateDate = DateTime.Now;
             clientData.Status     = 1;
             context.ClientData.Add(clientData);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 更新上下架狀態
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public static bool EditStatus(int id, int status)
        {
            try
            {
                using (var context = new HouseRulesEntities())
                {
                    var clientData = context.ClientData.FirstOrDefault(x => x.ID == id);

                    if (clientData == null)
                    {
                        return(false);
                    }

                    clientData.UpdateDate = DateTime.Now;
                    clientData.Status     = status;
                    context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }