Exemplo n.º 1
0
        /// <summary>
        /// 用户信息修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task<int> Save(T_Customer_Role model)
        {
            using (db = new KBLDataContext())
            {
                var entity = from r in db.CustomerRoles
                             where r.Rid == model.Rid
                             select r;
                T_Customer_Role role = await entity.FirstOrDefaultAsync();

                if (role == null)
                {
                    model.CreateDate = Helper.Comm.GetIntFromTime(DateTime.Now);
                    model.UpdateAccountDate = Helper.Comm.GetIntFromTime(DateTime.Now);
                    db.CustomerRoles.Add(model);
                }
                else
                {
                    role.UserName = model.UserName;
                    role.Password = model.Password;
                    role.Cid = model.Cid;
                    role.UpdateAccountDate = Helper.Comm.GetIntFromTime(DateTime.Now);
                    db.Entry(role).State = EntityState.Modified;
                }
                return await db.SaveChangesAsync();
            }
        }
Exemplo n.º 2
0
 public static async Task<int> SaveCustomerRole(T_Customer_Role model)
 {
     using (T_Customer_Role_Entities dao = new T_Customer_Role_Entities())
     {
         return await dao.Save(model);
     }
 }
Exemplo n.º 3
0
 public async Task<object> GetRole(T_Customer_Role model)
 {
     object o = new { };
     //if (model.Input0 != null)
     //{
     string s = string.Empty;
     //s = POSTJson.ResolveTJSON(model);
     //customer = JsonConvert.DeserializeObject<T_Customer>(s);
     o = await T_Customer_BLL.GetCustomerRole(model.Cid);
     //}
     return Ok(new
     {
         statusCode = 200,
         result = o
     });
 }
Exemplo n.º 4
0
 public async Task<object> Submit(T_JSON model)
 {
     T_Customer_Role role = new T_Customer_Role();
     object effects = 0;
     if (model.Input0 != null)
     {
         string s = string.Empty;
         s = POSTJson.ResolveTJSON(model);
         role = JsonConvert.DeserializeObject<T_Customer_Role>(s);
         effects = await T_Customer_BLL.SaveCustomerRole(role);
     }
     return Ok(new
     {
         statusCode = 200,
         result = effects
     });
 }