示例#1
0
        //---------------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);
        }
示例#2
0
 public bool Add(Uav uav)
 {
     try
     {
         _db.Uavs.Add(uav);
         return true;
     }
     catch
     {
         return false;
     }
 }