Beispiel #1
0
        public ResultModel <Enterprise> Add(EnterpriseCreateDto dto)
        {
            var model = new Enterprise
            {
                Id            = new Tools.Snowflake().GetId(),
                Name          = dto.Name,
                Address       = dto.Address,
                OrganCode     = dto.OrganCode,
                GPSLongitude  = dto.GPSLongitude,
                GPSLatitude   = dto.GPSLatitude,
                BmapLongitude = dto.BmapLongitude,
                BmapLatitude  = dto.BmapLatitude,
                TypeCode      = dto.TypeCode,
                Discharge     = dto.Discharge,
                Concentration = dto.Concentration
            };

            _efContext.Enterprises.Add(model);
            _efContext.SaveChanges();

            var result = new ResultModel <Enterprise>()
            {
                Code  = 0,
                Msg   = "成功",
                Count = 1,
            };

            result.Data.AddRange(new List <Enterprise>()
            {
                model
            });
            return(result);
        }
Beispiel #2
0
 public IActionResult Add(EnterpriseCreateDto dto)
 {
     return(new JsonResult(_enterpriseService.Add(dto)));
 }