public async Task EditAsync( int inspectionId, HiveCondition hiveCondition, string hygieneLevel, int honeyCombsCount, double honeyInKilos, double weight, double temperature) { var inspection = this.FindById(inspectionId); if (inspection == null) { return; } inspection.Id = inspectionId; // inspection.BeehiveId = beehiveId, inspection.HiveCondition = hiveCondition; inspection.HygieneLevel = hygieneLevel; inspection.HoneyCombsCount = honeyCombsCount; inspection.HoneyInKilos = honeyInKilos; inspection.BeehiveWeight = weight; inspection.Temperature = temperature; inspection.ModifiedOn = DateTime.UtcNow; await this.db.SaveChangesAsync(); }
public async Task <int> CreateAsync( int beehiveId, HiveCondition condition, string hygieneLevel, int honeyCombsCount, double honeyInKilos, double beehiveWeight, double temperature) { var inspection = new Inspection { BeehiveId = beehiveId, HiveCondition = condition, HygieneLevel = hygieneLevel, HoneyCombsCount = honeyCombsCount, HoneyInKilos = honeyInKilos, BeehiveWeight = beehiveWeight, Temperature = temperature, IsInspected = true, }; this.db.Inspections.Add(inspection); await this.db.SaveChangesAsync(); await this.AddInspectionToBeehive(beehiveId, inspection); return(inspection.Id); }