Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("CommunityFormBrecNo,DistrictOffice,OfficerPersonnelsName,PostName,Grade,JoiningDate,Gender,Religion,Category,FormRecNo")] CommunityFormB communityFormB)
        {
            if (id != communityFormB.CommunityFormBrecNo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(communityFormB);
                    var result = await _context.SaveChangesAsync();

                    if (result == 1)
                    {
                        Result          = "Updated";
                        ViewData["Msg"] = new MessageDTO {
                            Message = "Dear User,<br/>Details Successfully Updated!!.", Status = "S", BackPageAction = "Index", BackPageController = "CommunityA"
                        };
                    }
                    else
                    {
                        ViewData["Msg"] = new MessageDTO {
                            Message = "Dear User,<br/><b>Some Error Ocurred Please try Later. if the problem persists contact your system administrator..", Status = "E", BackPageAction = "Index", BackPageController = "CommunityA"
                        };
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommunityFormBExists(communityFormB.CommunityFormBrecNo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                //return RedirectToAction(nameof(Index));
            }
            return(View(communityFormB));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("CommunityFormBrecNo,DistrictOffice,OfficerPersonnelsName,PostName,Grade,JoiningDate,Gender,Religion,Category,FormRecNo")] CommunityFormB communityFormB)
        {
            if (ModelState.IsValid)
            {
                _context.Add(communityFormB);
                var result = await _context.SaveChangesAsync();

                if (result == 1)
                {
                    Result          = "Saved";
                    ViewData["Msg"] = new MessageDTO {
                        Message = "Dear User,<br/>Details Successfully Saved!!.", Status = "S", BackPageAction = "Index", BackPageController = "CommunityB"
                    };
                }
                else
                {
                    ViewData["Msg"] = new MessageDTO {
                        Message = "Dear User,<br/><b>Some Error Ocurred Please try Later. if the problem persists contact your system administrator..", Status = "E", BackPageAction = "Index", BackPageController = "CommunityB"
                    };
                }
            }
            return(View(communityFormB));
        }