public async Task <IActionResult> Create([Bind("Id,SenderName,SenderEmail")] Sender sender)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sender);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sender));
        }
        public async Task <IActionResult> Create([Bind("Id,ReceiverName,ReceiverEmail,RecieverMobile")] Receiver receiver)
        {
            if (ModelState.IsValid)
            {
                _context.Add(receiver);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(receiver));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("Id,MethodName")] MessagingType messagingType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(messagingType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(messagingType));
        }
        public async Task <IActionResult> Create([Bind("Id,SenderId,ReceiverId,MessagingTypeId,MessageBody")] Message message)
        {
            if (ModelState.IsValid)
            {
                _context.Add(message);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MessagingTypeId"] = new SelectList(_context.Set <MessagingType>(), "Id", "Id", message.MessagingTypeId);
            ViewData["ReceiverId"]      = new SelectList(_context.Set <Receiver>(), "Id", "Id", message.ReceiverId);
            ViewData["SenderId"]        = new SelectList(_context.Set <Sender>(), "Id", "Id", message.SenderId);
            return(View(message));
        }