public async Task <StatusCode> Update(AirplaneType entity) { var type = await AirplaneType.GetById(entity.Id); if (type != null) { Validation(entity); await AirplaneType.Update(entity.ToEntity()); return(StatusCode.Updated); } return(StatusCode.DoesNotExist); }
public async Task <StatusCode> Create(AirplaneType entity) { Validation(entity); var types = await AirplaneType.GetBy(entity.Name); var isExist = types != null; if (isExist) { return(StatusCode.AlreadyExists); } await AirplaneType.Create(entity.ToEntity()); return(StatusCode.Created); }