Skip to content

Commit

Permalink
Fixes #29 : Parameters that taking null value changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
qnill committed Sep 8, 2017
1 parent 797fd6d commit bed3181
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion RS.Core.Api/Base/Controller/BaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public virtual async Task<IHttpActionResult> GetByID(Y id)
return Ok(result);
}
[Route("GetSelectList"),HttpGet]
public virtual async Task<IHttpActionResult> AutoCompleteList(Y? id = null, string text = null)
public virtual async Task<IHttpActionResult> AutoCompleteList(Y? id = default(Y?), string text = default(string))
{
var result = await service.AutoCompleteList(id, text);

Expand Down
18 changes: 9 additions & 9 deletions RS.Core.Service/Base/Services/BaseService.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -62,7 +62,7 @@ public virtual async Task<APIResult> Add(A model,Y userID, bool isCommit = true)

return new APIResult { Data = entity.ID, Message = Messages.Ok };
}
public virtual async Task<APIResult> Update(U model, Y? userID = null, bool isCommit = true, bool checkAuthorize = false)
public virtual async Task<APIResult> Update(U model, Y? userID = default(Y?), bool isCommit = true, bool checkAuthorize = false)
{
D entity = await uow.Repository<D>().GetByID(model.ID);

Expand All @@ -89,7 +89,7 @@ public virtual async Task<APIResult> Update(U model, Y? userID = null, bool isCo

return new APIResult() { Message = Messages.Ok };
}
public virtual async Task<APIResult> Delete(Y id,Y? userID=null,bool isCommit=true, bool checkAuthorize = false)
public virtual async Task<APIResult> Delete(Y id,Y? userID= default(Y?), bool isCommit=true, bool checkAuthorize = false)
{
D entity = await uow.Repository<D>().GetByID(id);

Expand All @@ -116,7 +116,7 @@ public virtual async Task<APIResult> Delete(Y id,Y? userID=null,bool isCommit=tr

return new APIResult() { Data=id, Message = Messages.Ok };
}
public virtual async Task<G> GetByID(Y id,Y? userID=null, bool isDeleted = false)
public virtual async Task<G> 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)
Expand All @@ -129,7 +129,7 @@ public virtual async Task<G> GetByID(Y id,Y? userID=null, bool isDeleted = false

return await uow.Repository<D>().Query(isDeleted).Where(x => (object)x.ID == (object)id).ProjectTo<G>().FirstOrDefaultAsync();
}
public virtual async Task<IList<AutoCompleteListVM<Y>>> AutoCompleteList(Y? id = null, string text = null)
public virtual async Task<IList<AutoCompleteListVM<Y>>> AutoCompleteList(Y? id = default(Y?), string text = default(string))
{
var query = uow.Repository<D>().Query().ProjectTo<AutoCompleteList<Y>>().AsQueryable();

Expand Down
11 changes: 5 additions & 6 deletions RS.Core.Service/Base/Services/ICRUDService.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -11,9 +10,9 @@ public interface ICRUDService<A,U,G,Y>
where G : EntityGetDto<Y>
{
Task<APIResult> Add(A model, Y userID, bool isCommit = true);
Task<APIResult> Update(U model, Y? userID = null, bool isCommit = true, bool checkAuthorize = false);
Task<APIResult> Delete(Y id, Y? userID = null, bool isCommit = true, bool checkAuthorize = false);
Task<G> GetByID(Y id, Y? userID = null, bool isDeleted = false);
Task<IList<AutoCompleteListVM<Y>>> AutoCompleteList(Y? id = null, string text = null);
Task<APIResult> Update(U model, Y? userID = default(Y?), bool isCommit = true, bool checkAuthorize = false);
Task<APIResult> Delete(Y id, Y? userID = default(Y?), bool isCommit = true, bool checkAuthorize = false);
Task<G> GetByID(Y id, Y? userID = default(Y?), bool isDeleted = false);
Task<IList<AutoCompleteListVM<Y>>> AutoCompleteList(Y? id = default(Y?), string text = default(string));
}
}

0 comments on commit bed3181

Please sign in to comment.