Exemple #1
0
        public async Task <IActionResult> Edit(string id, [Bind("ID,CODE,NAME,CDATE,UDATE")] ehc_dv_bed model)
        {
            if (id != model.ID.ToString())
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    await _respository.UpdateAsync(model);


                    await this._respository.WriteUserLogger(this.GetUserID(), "编辑床位", model.CODE);
                }
                catch (DbUpdateConcurrencyException)
                {
                    var result = await _respository.GetByIDAsync(id);

                    if (result == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("ID,CODE,NAME,MATID,CDATE,UDATE")] ehc_dv_bed model)
        {
            if (ModelState.IsValid)
            {
                await _respository.InsertAsync(model);

                await this._respository.WriteUserLogger(this.GetUserID(), "添加床位", model.CODE);

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


            var beds = await this._respository.GetListAsync();

            Func <ehc_dd_device, bool> match = l => !beds.Exists(k => k
                                                                 .MATID == l.deviceID);

            await this.RefreshDropList(match);

            return(View(model));
        }