//---------------uav mappers--------------------------------------------------------------- protected UavDTO ToUavDTO(Uav uav) { Mapper.Reset(); Mapper.CreateMap<Uav, UavDTO>() .ForMember("Type", x => x.UseValue(ToUavTypeDTO(uav.Type))) .ForMember("Payloads", x => x.UseValue(PayloadsFromUav(uav.Id))) .ForMember("GcuTypes", x => x.UseValue(GcuTypesFromUav(uav.Id))); return Mapper.Map<Uav, UavDTO>(uav); }
public bool Add(Uav uav) { try { _db.Uavs.Add(uav); return true; } catch { return false; } }