Esempio n. 1
0
        public async Task <IActionResult> PutPmtctData(string id, PmtctData pmtctData)
        {
            if (id != pmtctData.NambaMshiriki01)
            {
                return(BadRequest());
            }

            _context.Entry(pmtctData).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PmtctDataExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ID,InitiatedART401,InitiatedARTDate401," +
                                                       "DeliveryFacility402,DeliveryFacilityDate402," +
                                                       "EarlyBirth403a,EarlyBirthDate403a,InfantHIVstatus403b,MotherResults403c," +
                                                       "MotherResultsDate403c,InfantBreastfeeding404a,InfantBreastfeedingDate404a," +
                                                       "RemarksName,NambaMshiriki01,UserId,Wilaya02,TareheMahojiano03," +
                                                       "Kituo04,JinaAnayehoji05,Ngazikituo06,MdaKuishiZanzibar109,KiwangoElimu102,Umri101," +
                                                       "WilayaUnayoishi107,IdadiMimba106,HaliNdoa103,KipatoMwezi104,Kazi105,NjeZanzibar108," +
                                                       "KilomitaKituo201,KilomitaUjazo202,HudumaUjauzito203,UgumuKliniki204a,HudumaHapa205," +
                                                       "BasiMbaliAfya204b_1,UgumuUsafiriUmma204b_2,KukosaNauli204b_3,MsafaraMrefu204b_4," +
                                                       "AnaishiMbaliBasi204b_5,AnaishiMbaliAfya204b_6,Mengine204b_7,TajaMengine204b," +
                                                       "UmepataHapaHuduma206,UmriMimba301,MwakaVVU302,MdaVVU303,DawaVVU304a,LiniDawaVVU304b,CTC304c")] PmtctData pmtctData)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    pmtctData.CreatedDate = DateTime.Now;

                    _context.Add(pmtctData);
                    await _context.SaveChangesAsync();

                    _logger.LogInformation(LoggingEvents.InsertItem, "Mteja {Id} Created by {user}", pmtctData.ID, User.Identity.Name);

                    return(RedirectToAction(nameof(Create)));
                }
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save a record. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator, Watch 'Namba ya Mshiriki' Must be unique.");
            }
            return(View(pmtctData));
        }
        public async Task <IActionResult> PutPmtctFollowUp(int id, PmtctFollowUp pmtctFollowUp)
        {
            if (id != pmtctFollowUp.ID)
            {
                return(BadRequest());
            }

            _context.Entry(pmtctFollowUp).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PmtctFollowUpExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("ID,TareheHudhurio,HaliYako305a,Mwenza305b1," +
                                                       "Mwanafamiliaa305b2,Wazazi305b3,Rafiki305b1,Mfanyakazi305b5,Wengine305b6,Tajawengine305b7," +
                                                       "Naogopakutengwa306a1,Naogopakuachwa306a2,kunyanyapaliwa306a2,BadosijaaminiVVUliwa306a4," +
                                                       "Sinaninaemwamini306a6,Nyinginezo306a6,MpangoMtu306b,HaliMwenza307,KuhudumiwaTofautiVVU308a," +
                                                       "Mwenza308b1,Mwanafamiliaa308b2,Wazazi308b3,Rafiki308b1,Mfanyakazi308b5,Mhudumu308b6,Wengine308b7," +
                                                       "Tajawengine308b8,UmejiungaVVU309a,NdioTaja309b,MamaMwambata310a,Ushauri310b1,Elimuafya310b2," +
                                                       "Ufuatiliaji310b3,Nyinginezo310b4,Rufaa,TareheHudhurioLijalo,Ufuatiliaji,JinaMtoHuduma," +
                                                       "NambaMshiriki01")] PmtctFollowUp pmtctFollowUp)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pmtctFollowUp);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pmtctFollowUp));
        }