public async Task <ActionResult> DeleteMainActivityMaster(int main_activity_id) { string result = string.Empty; MainActivityMasterViewModel mainActivityItem = new MainActivityMasterViewModel(); var mainMasterItem = await _mainActivityMasterHelper.GetAllMainActivityMasterById(main_activity_id); if (mainMasterItem.Count > 0) { mainActivityItem.MainActivityId = Convert.ToInt32(mainMasterItem[0].MainActivityId); mainActivityItem.GroupId = Convert.ToInt32(mainMasterItem[0].GroupId); mainActivityItem.MainActivityName = mainMasterItem[0].MainActivityName; mainActivityItem.OrgId = mainMasterItem[0].OrgId; mainActivityItem.Sequence = mainMasterItem[0].Sequence; mainActivityItem.Status = mainMasterItem[0].Status; mainActivityItem.IsDeleted = true; } var objSaveMainActivityMaster = await _mainActivityMasterHelper.UpdateMainActivityMasterDetails(mainActivityItem); if (objSaveMainActivityMaster.MainActivityId > 0) { objSaveMainActivityMaster.Success = true; objSaveMainActivityMaster.Message = "Main activity master saved successfully!!!!!"; } return(Json(objSaveMainActivityMaster)); }
public async Task <IActionResult> Index() { var mainActivityMasterList = await _activityMasterHelper.GetAllActivityMasterDetails(); List <ActivityMasterViewModel> lstactivityMasters = new List <ActivityMasterViewModel>(); //lstMainActivityMasters = mainActivityMasterList; if (mainActivityMasterList.Count > 0) { foreach (var item in mainActivityMasterList) { string mainActivityName = string.Empty; var mainActivityDetails = await _mainActivityMasterHelper.GetAllMainActivityMasterById(item.MainActivityId); if (mainActivityDetails != null) { mainActivityName = mainActivityDetails[0].GroupName; } ActivityMasterViewModel mainActivity = new ActivityMasterViewModel() { ActivityId = item.ActivityId, MainActivityId = item.MainActivityId, MainActivityName = mainActivityName, ActivityName = item.ActivityName, ParentId = item.ParentId, OrgId = item.OrgId, Status = item.Status, Sequence = item.Sequence, IsDeleted = item.IsDeleted }; lstactivityMasters.Add(mainActivity); } } return(View(lstactivityMasters)); }