public string r_area(dtoG ob) { try { ob.id = ob.id; areas m = new areas(); AutoMapper.Mapper.CreateMap<dtoG, areas>(); AutoMapper.Mapper.Map(ob, m); bd.areas.Add(m); bd.SaveChanges(); return "¡Se agregó el area exitosamente!"; } catch (Exception) { return null; } }
public dtoG c_area(string cod) { try { cod = cod.ToUpper(); origen = bd.areas.Where(t => t.id == cod).FirstOrDefault(); if (origen != null) { AutoMapper.Mapper.CreateMap<areas, dtoG>(); AutoMapper.Mapper.Map(origen, destino); return destino; } else { return null; } } catch (Exception) { return null; } }