Ejemplo n.º 1
0
        public void AddEthnic(Ethnic ethnic)
        {
            context.Ethnics.Add(ethnic);
            SetAuditFields(ethnic);

            context.SaveChanges();
        }
Ejemplo n.º 2
0
        public ActionResult Create(CreateEditViewModel model)
        {
            var ethnic = new Ethnic();

            Mapper.DynamicMap(model, ethnic);
            ethnicProvider.AddEthnic(ethnic);

            var jsonViewModel = new AjaxViewModel(true, model, null);

            return(Json(jsonViewModel));
        }
Ejemplo n.º 3
0
        public async Task <Ethnic> Get(long Id)
        {
            Ethnic Ethnic = await context.Ethnic.Where(d => d.Id == Id).Select(d => new Ethnic
            {
                Id   = d.Id,
                Code = d.Code,
                Name = d.Name,
            }).FirstOrDefaultAsync();

            return(Ethnic);
        }
Ejemplo n.º 4
0
        public async Task <Ethnic> Get(Guid Id)
        {
            Ethnic Ethnic = await tFContext.Ethnic.Where(d => d.Id.Equals(Id)).Select(d => new Ethnic
            {
                Id   = d.Id,
                Code = d.Code,
                Name = d.Name,
            }).FirstOrDefaultAsync();

            return(Ethnic);
        }
Ejemplo n.º 5
0
        public async Task <EthnicDTO> GetEthnic([FromBody] EthnicDTO ethnicDTO)
        {
            if (ethnicDTO == null)
            {
                ethnicDTO = new EthnicDTO();
            }
            var ethnic = new Ethnic {
                Id = ethnicDTO.Id
            };

            ethnic = await EthnicService.Get(ethnic.Id);

            return(ethnic == null ? null : new EthnicDTO
            {
                Id = ethnic.Id,
                Code = ethnic.Code,
                Name = ethnic.Name
            });
        }
Ejemplo n.º 6
0
 public void UpdateEthnic(Ethnic ethnic)
 {
     SetAuditFields(ethnic);
     context.SaveChanges();
 }