Esempio n. 1
0
        public async Task <StatusCode> Update(AirplaneSchema entity)
        {
            var schemas = await AirplaneSchema.GetById(entity.Id);

            if (schemas != null)
            {
                Validation(entity);
                await AirplaneSchema.Update(entity.ToEntity());

                return(StatusCode.Updated);
            }
            return(StatusCode.DoesNotExist);
        }
Esempio n. 2
0
        public async Task <StatusCode> Create(AirplaneSchema entity)
        {
            Validation(entity);
            var schemas = await AirplaneSchema.GetBy(entity.Name);

            var isExist = schemas != null;

            if (isExist)
            {
                return(StatusCode.AlreadyExists);
            }

            await AirplaneSchema.Create(entity.ToEntity());

            return(StatusCode.Created);
        }