Esempio n. 1
0
        public ActionResult Delete(int id, RemoteCommandModel remoteCommandModel)
        {
            try
            {
                RemoteCommandMockRepository.Singleton.DeleteRemoteCommandById(id);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 2
0
        public ActionResult Edit(int id, RemoteCommandModel remoteCommandModel)
        {
            try
            {
                var remoteCommand = RemoteCommandMockRepository.Singleton.GetRemoteCommandById(id);

                remoteCommand.Name       = remoteCommandModel.Name;
                remoteCommand.SignalCode = remoteCommandModel.SignalCode;

                RemoteCommandMockRepository.Singleton.UpdateRemoteCommand(remoteCommand);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View(remoteCommandModel));
            }
        }
Esempio n. 3
0
        public ActionResult Create(RemoteCommandModel remoteCommandModel)
        {
            try
            {
                var remoteCommand = new RemoteCommand
                {
                    Name       = remoteCommandModel.Name,
                    SignalCode = remoteCommandModel.SignalCode
                };

                RemoteCommandMockRepository.Singleton.InsertRemoteCommand(remoteCommand);
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View(remoteCommandModel));
            }
        }