Ejemplo n.º 1
0
        public int Create(NoteModel model)
        {
            var entity = new NoteEntity
            {
                Title = model.Title,
                Latitude = model.Latitude,
                Longitude = model.Longitude,
                DateCreated = DateTime.UtcNow,
                IsActive = true,
                UserId = model.UserId
            };

            Context.Note.Add(entity);
            Context.SaveChanges();

            return entity.Id;
        }
Ejemplo n.º 2
0
        public HttpResponseMessage CreateNote([FromBody]CreateNoteRequest request)
        {
            var noteManager = IoC.Instance.Resolve<INoteManager>();
            var userId = User.Identity.GetUserId();

            var model = new NoteModel
            {
                Title = request.Title,
                Latitude = request.Lattitude,
                Longitude = request.Longitude,
                UserId = userId
            };

            var noteId = noteManager.Repository.Create(model);
            noteManager.RebuildIndex(userId, noteId);

            Thread.Sleep(1000);

            return new HttpResponseMessage(HttpStatusCode.OK);
        }