Esempio n. 1
0
        public async Task <ResponceModel> Delete(int id)
        {
            var identifier = User.Claims.FirstOrDefault(p => p.Type == "id");

            if (identifier == null)
            {
                return(new ResponceModel(401, "FAILED", null, new string[] { "Yetkilendirme Hatası." }));
            }
            try
            {
                districtService.Delete(id);
                if (await districtService.SaveChanges())
                {
                    return(new ResponceModel(200, "OK", null, null));
                }
                else
                {
                    return(new ResponceModel(400, "FAILD", null, new string[] { "İlçe silinirken bir sorun oluştu." }));
                }
            }
            catch (Exception ex)
            {
                await _logService.Add(new SystemLog()
                {
                    Content = ex.Message, CreateDate = DateTime.Now, UserId = 0, EntityName = districtService.GetType().Name
                });

                return(new ResponceModel(500, "ERROR", null, new string[] { "İlçe silinirken bir sorun oluştu." }));
            }
        }
Esempio n. 2
0
        public ActionResult DeleteDistrict(string Id)
        {
            int DistrictId = DecryptQueryString(Id);

            if (DistrictId < 1)
            {
                return(RedirectToAction("DistrictLookup"));
            }

            ResultDto resultDto = _districtService.Delete(DistrictId, UserInfo.UserID);

            TempData["Result"] = resultDto;

            return(RedirectToAction("DistrictLookup"));
        }
Esempio n. 3
0
    protected void grvArea_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int iEditId = 0;

        iEditId = Convert.ToInt32(e.CommandArgument.ToString());
        string aName = e.CommandName.ToLower();

        if (iEditId > 0)
        {
            DistrictService objlogic = new DistrictService();
            if (aName.Contains("_edit"))
            {
                District obj = new District();
                obj = objlogic.FindByKey(iEditId);
                if (obj != null)
                {
                    hdnEditId.Value  = iEditId.ToString();
                    txtCode.Text     = obj.DistrictCode;
                    txtSorOrder.Text = obj.SortOrder.ToString();
                    txtTitle.Text    = obj.DistrictName;
                    if (obj.ProvinceId > 0)
                    {
                        ddlParent.SelectedValue = obj.ProvinceId.ToString();
                    }
                    ScriptManager.RegisterStartupScript(this, GetType(), "showform", "updatedistrict();", true);
                }
            }
            else if (aName.Contains("_delete"))
            {
                if (objlogic.Delete(Convert.ToInt32(iEditId)) > 0)
                {
                    BindData();
                }
            }
        }
    }
 public bool Delete(long id)
 {
     return(_service.Delete(id));
 }