Example #1
0
        public void Create(Member_Model model)
        {
            var data = Connect_Enttity.Members.FirstOrDefault(x => x.Id == model.Id);

            if (data == null)
            {
                var entity = new Member();

                entity.Name          = model.Name;
                entity.Email         = model.Email;
                entity.Username      = model.Username;
                entity.Password      = model.Password;
                entity.GroupMemberId = (int)(model.GroupMemberId);
                entity.Active        = (int)(model.Active);
                entity.NameEn        = model.NameEn;
                entity.Isplace       = model.Isplace;
                entity.IsplaceEn     = model.IsplaceEn;
                entity.Note          = model.Note;
                entity.NoteEn        = model.NoteEn;

                Connect_Enttity.Members.Add(entity);
                Connect_Enttity.SaveChanges();
                Dispose();
            }
        }
Example #2
0
        public IList <Member_Model> GetId(Member_Model model)
        {
            IList <Member_Model> result = new List <Member_Model>();

            result = Connect_Enttity.Members.Where(x => x.Id == model.Id).Select(x => new Member_Model
            {
                Id            = x.Id,
                Name          = x.Name,
                Email         = x.Email,
                Username      = x.Username,
                Password      = x.Password,
                GroupMemberId = (int)(x.GroupMemberId),
                Active        = (int)(x.Active),
                NameEn        = x.NameEn,
                Isplace       = x.Isplace,
                IsplaceEn     = x.IsplaceEn,
                Note          = x.Note,
                NoteEn        = x.NoteEn
            }).ToList();

            return(result);
        }
Example #3
0
        public void Update(Member_Model model)
        {
            var data = Connect_Enttity.Members.FirstOrDefault(x => x.Id == model.Id);

            if (data != null)
            {
                data.Name          = model.Name;
                data.Email         = model.Email;
                data.Username      = model.Username;
                data.Password      = model.Password;
                data.GroupMemberId = (int)(model.GroupMemberId);
                data.Active        = (int)(model.Active);
                data.NameEn        = model.NameEn;
                data.Isplace       = model.Isplace;
                data.IsplaceEn     = model.IsplaceEn;
                data.Note          = model.Note;
                data.NoteEn        = model.NoteEn;

                Connect_Enttity.SaveChanges();
                Dispose();
            }
        }
Example #4
0
 public IEnumerable <Member_Model> ReadID(Member_Model model)
 {
     return(GetId(model));
 }