public ActionResult UpdateLang(PlaceTypeGroupLangModel model)
        {
            var msg       = ManagerResource.LB_OPERATION_SUCCESS;
            var isSuccess = false;

            if (!ModelState.IsValid)
            {
                string messages = string.Join("; ", ModelState.Values
                                              .SelectMany(x => x.Errors)
                                              .Select(x => x.ErrorMessage + x.Exception));
                this.AddNotification(messages, NotificationType.ERROR);

                return(Json(new { success = isSuccess, title = ManagerResource.LB_NOTIFICATION, message = messages }));
            }

            try
            {
                var code = 0;

                //Begin db transaction
                var data = new IdentityPlaceTypeGroupLang();
                data.GroupId   = model.GroupId;
                data.Id        = model.Id;
                data.LangCode  = model.LangCode;
                data.GroupName = model.Name;

                if (model.Id > 0)
                {
                    //Update
                    _mainStore.UpdateLang(data);
                }
                else
                {
                    //Add new
                    code = _mainStore.AddNewLang(data);

                    if (code == EnumCommonCode.Error)
                    {
                        return(Json(new { success = isSuccess, title = ManagerResource.LB_NOTIFICATION, message = ManagerResource.LB_DUPLICATE_DATA, clientcallback = " location.reload()" }));
                    }
                }

                isSuccess = true;
            }
            catch (Exception ex)
            {
                this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR);

                logger.Error("Failed for UpdateLang request: " + ex.ToString());

                return(Json(new { success = isSuccess, title = ManagerResource.LB_NOTIFICATION, message = NotifSettings.Error_SystemBusy }));
            }

            return(Json(new { success = isSuccess, title = ManagerResource.LB_NOTIFICATION, message = msg, clientcallback = " location.reload()" }));
        }
        public ActionResult UpdateLang()
        {
            PlaceTypeGroupLangModel model = new PlaceTypeGroupLangModel();
            var id      = Utils.ConvertToInt32(Request["Id"]);
            var groupId = Utils.ConvertToInt32(Request["GroupId"]);

            if (groupId == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (id > 0)
            {
                model.IsUpdate = true;
            }

            try
            {
                model.Languages = CommonHelpers.GetListLanguages();
                model.GroupId   = groupId;

                //Begin db transaction
                var info = _mainStore.GetLangDetail(id);

                if (info != null)
                {
                    model.GroupId  = groupId;
                    model.Id       = info.Id;
                    model.LangCode = info.LangCode;
                    model.Name     = info.GroupName;
                }
            }
            catch (Exception ex)
            {
                this.AddNotification(NotifSettings.Error_SystemBusy, NotificationType.ERROR);

                logger.Error("Failed for Show UpdateLang frm request: " + ex.ToString());
            }

            return(PartialView("../PlaceTypeGroup/_UpdateLang", model));
        }