Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("CommunityFormCrecNo,DistrictOffice,OfficerPersonnelsName,PostName,Grade,JoiningDate,Gender,Religion,Category,FormRecNo")] CommunityFormC communityFormC)
        {
            if (id != communityFormC.CommunityFormCrecNo)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(communityFormC);
                    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 = "CommunityC"
                        };
                    }
                    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 = "CommunityC"
                        };
                    }
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommunityFormCExists(communityFormC.CommunityFormCrecNo))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                //return RedirectToAction(nameof(Index));
            }
            return(View(communityFormC));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("CommunityFormCrecNo,DistrictOffice,OfficerPersonnelsName,PostName,Grade,JoiningDate,Gender,Religion,Category,FormRecNo")] CommunityFormC communityFormC)
        {
            if (ModelState.IsValid)
            {
                _context.Add(communityFormC);
                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 = "CommunityC"
                    };
                }
                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 = "CommunityC"
                    };
                }
            }
            return(View(communityFormC));
        }