Esempio n. 1
0
        public void UpdateWithId0()
        {
            var motd = new MOTD()
            {
                Id          = 0,
                TipOfTheDay = "One Dane per day, makes problems go away"
            };

            Exception ex = Assert.ThrowsException <ArgumentException>(() =>
                                                                      motdService.UpdateMOTD(motd));

            Assert.AreEqual("You need to have an higher id than 0", ex.Message);
        }
Esempio n. 2
0
        public ActionResult <MOTD> PutMOTD([FromRoute] int id, [FromBody] MOTD mOTD)
        {
            try
            {
                var entity = _MOTDServices.UpdateMOTD(mOTD);
                entity.TipOfTheDay = mOTD.TipOfTheDay;
                return(Ok(entity));
            }

            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }