예제 #1
0
        public async Task <IActionResult> Edit(int id, TypesMessage typesMessage)
        {
            if (id != typesMessage.Id)
            {
                ViewBag.ErrorMessage = "لايوجد   بيانات";
                return(View("NotFound"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _repository.Update <TypesMessage>(typesMessage);
                    await _repository.SavaAll();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (_repository.GetTypesMessage(typesMessage.Id) == null)
                    {
                        ViewBag.ErrorMessage = "لايوجد   بيانات";
                        return(View("NotFound"));
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(typesMessage));
        }
예제 #2
0
 /// <summary>
 /// Create a new Example
 /// </summary>
 public Example()
 {
     Log        = new LogMessage();
     Structures = new StructuresMessage();
     Binary     = new BinaryMessage();
     Types      = new TypesMessage();
 }
예제 #3
0
        public async Task <IActionResult> Create(TypesMessage typesMessage)
        {
            if (ModelState.IsValid)
            {
                _repository.Add <TypesMessage>(typesMessage);
                await _repository.SavaAll();

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