Пример #1
0
        public async Task <ActionResult> BeginMonitor(string[] id)
        {
            try
            {
                if (id.Length != 0)
                {
                    foreach (var itemid in id)
                    {
                        Guid gid     = new Guid(itemid);
                        bool IsExist = await MonitorRepository.ExistAsync(o => o.MonitorID == gid);

                        if (IsExist)
                        {
                            Monitor mo = await MonitorRepository.FindAsync(o => o.MonitorID == gid);

                            mo.IsActive = true;
                            if (!MonitorRepository.Update(mo))
                            {
                                return(Json(new
                                {
                                    Success = false,
                                    Msg = "更新数据有误。"
                                }));
                            }
                        }
                    }
                }
                return(Json(new
                {
                    Success = true
                }));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    Success = false,
                    Msg = ex.ToString()
                }));
            }
        }