Exemplo n.º 1
0
        public void Update(Province_Model model)
        {
            var data = Connect_Enttity.Provinces.FirstOrDefault(x => x.Id == model.Id);

            if (data != null)
            {
                data.Name   = model.Name;
                data.NameEn = model.NameEn;

                Connect_Enttity.SaveChanges();
                Dispose();
            }
        }
Exemplo n.º 2
0
        public IList <Province_Model> GetId(Province_Model model)
        {
            IList <Province_Model> result = new List <Province_Model>();

            result = Connect_Enttity.Provinces.Where(x => x.Id == model.Id).Select(x => new Province_Model
            {
                Id     = x.Id,
                Name   = x.Name,
                NameEn = x.NameEn
            }).ToList();

            return(result);
        }
Exemplo n.º 3
0
        public void Create(Province_Model model)
        {
            var data = Connect_Enttity.Provinces.FirstOrDefault(x => x.Id == model.Id);

            if (data == null)
            {
                var entity = new Province();
                entity.Name   = model.Name;
                entity.NameEn = model.NameEn;

                Connect_Enttity.Provinces.Add(entity);
                Connect_Enttity.SaveChanges();
                Dispose();
            }
        }
Exemplo n.º 4
0
 public IEnumerable <Province_Model> ReadID(Province_Model model)
 {
     return(GetId(model));
 }