From bed3181f09d960dff8886d387123296ce07d852e Mon Sep 17 00:00:00 2001 From: qnill Date: Fri, 8 Sep 2017 23:31:47 +0300 Subject: [PATCH] Fixes #29 : Parameters that taking null value changed. --- RS.Core.Api/Base/Controller/BaseController.cs | 2 +- RS.Core.Service/Base/Services/BaseService.cs | 18 +++++++++--------- RS.Core.Service/Base/Services/ICRUDService.cs | 11 +++++------ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/RS.Core.Api/Base/Controller/BaseController.cs b/RS.Core.Api/Base/Controller/BaseController.cs index 66a9997..2be46c7 100644 --- a/RS.Core.Api/Base/Controller/BaseController.cs +++ b/RS.Core.Api/Base/Controller/BaseController.cs @@ -74,7 +74,7 @@ public virtual async Task GetByID(Y id) return Ok(result); } [Route("GetSelectList"),HttpGet] - public virtual async Task AutoCompleteList(Y? id = null, string text = null) + public virtual async Task AutoCompleteList(Y? id = default(Y?), string text = default(string)) { var result = await service.AutoCompleteList(id, text); diff --git a/RS.Core.Service/Base/Services/BaseService.cs b/RS.Core.Service/Base/Services/BaseService.cs index 6b4bb66..b724c4d 100644 --- a/RS.Core.Service/Base/Services/BaseService.cs +++ b/RS.Core.Service/Base/Services/BaseService.cs @@ -1,15 +1,15 @@ using AutoMapper; using AutoMapper.QueryableExtensions; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using RS.Core.Const; -using RS.Core.Lib; using RS.Core.Domain; +using RS.Core.Lib; using RS.Core.Service.DTOs; +using System; +using System.Collections.Generic; using System.ComponentModel; using System.Data.Entity; +using System.Linq; +using System.Threading.Tasks; namespace RS.Core.Service { @@ -62,7 +62,7 @@ public virtual async Task Add(A model,Y userID, bool isCommit = true) return new APIResult { Data = entity.ID, Message = Messages.Ok }; } - public virtual async Task Update(U model, Y? userID = null, bool isCommit = true, bool checkAuthorize = false) + public virtual async Task Update(U model, Y? userID = default(Y?), bool isCommit = true, bool checkAuthorize = false) { D entity = await uow.Repository().GetByID(model.ID); @@ -89,7 +89,7 @@ public virtual async Task Update(U model, Y? userID = null, bool isCo return new APIResult() { Message = Messages.Ok }; } - public virtual async Task Delete(Y id,Y? userID=null,bool isCommit=true, bool checkAuthorize = false) + public virtual async Task Delete(Y id,Y? userID= default(Y?), bool isCommit=true, bool checkAuthorize = false) { D entity = await uow.Repository().GetByID(id); @@ -116,7 +116,7 @@ public virtual async Task Delete(Y id,Y? userID=null,bool isCommit=tr return new APIResult() { Data=id, Message = Messages.Ok }; } - public virtual async Task GetByID(Y id,Y? userID=null, bool isDeleted = false) + public virtual async Task GetByID(Y id,Y? userID= default(Y?), bool isDeleted = false) { //İlgili kaydın, ilgili kullanıcıya ait olma durumunu kontrol etmektedir. if (userID != null) @@ -129,7 +129,7 @@ public virtual async Task GetByID(Y id,Y? userID=null, bool isDeleted = false return await uow.Repository().Query(isDeleted).Where(x => (object)x.ID == (object)id).ProjectTo().FirstOrDefaultAsync(); } - public virtual async Task>> AutoCompleteList(Y? id = null, string text = null) + public virtual async Task>> AutoCompleteList(Y? id = default(Y?), string text = default(string)) { var query = uow.Repository().Query().ProjectTo>().AsQueryable(); diff --git a/RS.Core.Service/Base/Services/ICRUDService.cs b/RS.Core.Service/Base/Services/ICRUDService.cs index a5d8ebf..5d04c7c 100644 --- a/RS.Core.Service/Base/Services/ICRUDService.cs +++ b/RS.Core.Service/Base/Services/ICRUDService.cs @@ -1,7 +1,6 @@ using RS.Core.Service.DTOs; -using System.Threading.Tasks; -using System; using System.Collections.Generic; +using System.Threading.Tasks; namespace RS.Core.Service { @@ -11,9 +10,9 @@ public interface ICRUDService where G : EntityGetDto { Task Add(A model, Y userID, bool isCommit = true); - Task Update(U model, Y? userID = null, bool isCommit = true, bool checkAuthorize = false); - Task Delete(Y id, Y? userID = null, bool isCommit = true, bool checkAuthorize = false); - Task GetByID(Y id, Y? userID = null, bool isDeleted = false); - Task>> AutoCompleteList(Y? id = null, string text = null); + Task Update(U model, Y? userID = default(Y?), bool isCommit = true, bool checkAuthorize = false); + Task Delete(Y id, Y? userID = default(Y?), bool isCommit = true, bool checkAuthorize = false); + Task GetByID(Y id, Y? userID = default(Y?), bool isDeleted = false); + Task>> AutoCompleteList(Y? id = default(Y?), string text = default(string)); } }