Exemplo n.º 1
0
 public string Add()
 {
     alarmRepository.Add(new SampleTimeModel {
         Date = DateTime.Now, Hour = 12, Minute = 12, Description = "test alarm"
     });
     return("Added something to Db");
 }
Exemplo n.º 2
0
        public async Task <IActionResult> Add(SampleTimeViewModel alarm)
        {
            var alarmToAdd = mapper.Map <SampleTimeModel>(alarm);

            if (ModelState.IsValid)
            {
                await alarmRepository.Add(alarmToAdd);

                return(RedirectToAction("Index", "Home"));
            }

            return(View());
        }