Beispiel #1
0
 /// <summary>
 /// CommonController Constructor
 /// </summary>
 /// <param name=""></param>
 public CommonController(IRemarksService remarksService, ISystemParametersService spService)
 {
     _remarksService = remarksService;
     _spService      = spService;
     logger          = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     logger.Info(string.Format("{0}.{1} - START", DateTime.Now, DateTime.Now.Day));
 }
 public RemarksServiceTests()
 {
     _repository = Substitute.For <IRemarksRepository>();
     _service    = new RemarksService(_repository);
 }
Beispiel #3
0
        public async Task <ActionResult <ApiResponse> > DeleteRemark(string remarkId, [FromServices] IRemarksService remarksService)
        {
            await remarksService.DeleteRemark(remarkId);

            return(ApiResponseHelper.Ok("Remark deleted.", remarkId));
        }
Beispiel #4
0
        public async Task <ActionResult <ApiResponse> > UpdateRemark(string remarkId, [FromBody] UpdateRemarkRequest updates, [FromServices] IRemarksService remarksService)
        {
            await remarksService.UpdateRemark(remarkId, updates);

            return(ApiResponseHelper.Ok("Remark updated.", remarkId));
        }
Beispiel #5
0
        public async Task <ActionResult <ApiResponse> > AddRemark([FromBody] AddRemarkRequest remark, [FromServices] IRemarksService remarksService, [FromServices] IUserDetailsProvider userDetailsProvider)
        {
            var userDetails = userDetailsProvider.GetUserDetails();
            var response    = await remarksService.AddRemark(userDetails.Email, remark);

            return(ApiResponseHelper.Created("Remark created.", response));
        }
Beispiel #6
0
        public async Task <ActionResult <ApiResponse> > GetRemarks([FromQuery] string filter, [FromServices] IRemarksService remarksService)
        {
            var response = await remarksService.GetRemarks(filter);

            return(ApiResponseHelper.Ok($"{response.Count()} remark(s) found.", response));
        }