private FieldsStage BuildFieldStage(AgriculturalStageEnum id, DateTime date, TimeSpan duration) { var isCurrent = date <= DateTime.Now && date + duration > DateTime.Now; return(new FieldsStage { Id = id, StartDate = date, Duration = duration, IsCurrent = isCurrent }); }
public void UpdateField(Guid id, int cultureId, AgriculturalStageEnum stage, DateTime startDate) { var field = GetField(id); var culture = _cropData.Crops.FirstOrDefault(c => c.Id == cultureId); field.Culture = culture.Name; var currentStage = new FieldsStage { Id = stage, StartDate = startDate, IsCurrent = true }; var stages = _fieldsStageService.CalculateStagesFromCurrent(field.FieldsStages, currentStage); field.FieldsStages = stages; _fieldsRepository.UpdateField(field); }
public FieldsStage GetNextStage(List <FieldsStage> stages, AgriculturalStageEnum currentStageId) { throw new NotImplementedException(); }