public async Task <IActionResult> PostHealthDeclarationAsync([FromBody] HealthDeclaration request)
        {
            //EntityTypeId=2 עובדים
            //EntityTypeId=11 מבקרים
            //מבקר בינתיים יכול להיות ריק
            //  אם הוא לא מקושר לטבלת מבקרים

            var entity = request;

            entity.Date = DateTime.Now.Date;

            var response = await HealthService.CreateHealthDeclarationAsync(entity);


            var Alert = new Alerts();

            Alert.EntityId     = request.EntityId;
            Alert.EntityTypeId = request.EntityTypeId; // עובדים
            Alert.AlertTypeId  = 7;                    //הצהרת בריאות
            Alert.SiteId       = request.SiteId;

            var responseAlert = await AlertService.GetAlertAsync(Alert);

            if (responseAlert.Model != null)
            {
                responseAlert.Model.AlertStatusId = 2;//נקרא
                await AlertService.UpdateAlertAsync(responseAlert.Model);
            }
            return(response.ToHttpResponse());
        }
Beispiel #2
0
        public async Task <IActionResult> GetMainScreenHealthAsync(int Id)
        {
            //נתונים כלליים
            var response = await HealthService.GetMainScreenHealthAsync(Id);

            //התראות
            var responseAlert = await AlertService.GetAlertAsync(Id, 2);

            response.Model.ListAlertsResponse = responseAlert.Model.ToList();

            //אתרים נוספים
            return(response.ToHttpResponse());
        }